# Path: tsuru_autoscale/datasource/forms.py
# class DataSourceForm(forms.Form):
#     name = forms.CharField()
#     url = forms.CharField()
#     method = forms.CharField()
#     body = forms.CharField(required=False)
#     headers = forms.CharField(required=False)
# 
# Path: tsuru_autoscale/datasource/client.py
# def host():
# def new(data, token):
# def list(token):
# def remove(name, token):
# def get(name, token):


from django.test import TestCase
from django.core.urlresolvers import reverse
from tsuru_autoscale.datasource.forms import DataSourceForm
from tsuru_autoscale.datasource import client
import httpretty
import mock
import os
        client.new({}, "token")

    def test_list(self):
        os.environ["AUTOSCALE_HOST"] = "http://autoscalehost.com"
        httpretty.register_uri(
            httpretty.GET,
            "http://autoscalehost.com/datasource",
        )

        client.list("token")

        self.assertDictEqual(httpretty.last_request().querystring, {"public": ["true"]})

    def test_remove(self):
        os.environ["AUTOSCALE_HOST"] = "http://autoscalehost.com"
        httpretty.register_uri(
            httpretty.DELETE,
            "http://autoscalehost.com/datasource/name",
        )

        client.remove("name", "token")

    def test_get(self):
        os.environ["AUTOSCALE_HOST"] = "http://autoscalehost.com"
        httpretty.register_uri(
            httpretty.GET,
            "http://autoscalehost.com/datasource/name",
            "result",
        )


# Path: tsuru_autoscale/datasource/forms.py
# class DataSourceForm(forms.Form):
#     name = forms.CharField()
#     url = forms.CharField()
#     method = forms.CharField()
#     body = forms.CharField(required=False)
#     headers = forms.CharField(required=False)
# 
# Path: tsuru_autoscale/datasource/client.py
# def host():
# def new(data, token):
# def list(token):
# def remove(name, token):
# def get(name, token):


# Path: tsuru_autoscale/datasource/tests.py
from django.test import TestCase
from django.core.urlresolvers import reverse
from tsuru_autoscale.datasource.forms import DataSourceForm
from tsuru_autoscale.datasource import client
import httpretty
import mock
import os

        client.new({}, "token")

    def test_list(self):
        os.environ["AUTOSCALE_HOST"] = "http://autoscalehost.com"
        httpretty.register_uri(
            httpretty.GET,
            "http://autoscalehost.com/datasource",
        )

        client.list("token")

        self.assertDictEqual(httpretty.last_request().querystring, {"public": ["true"]})

    def test_remove(self):
        os.environ["AUTOSCALE_HOST"] = "http://autoscalehost.com"
        httpretty.register_uri(
            httpretty.DELETE,
            "http://autoscalehost.com/datasource/name",
        )

        client.remove("name", "token")

    def test_get(self):
        os.environ["AUTOSCALE_HOST"] = "http://autoscalehost.com"
        httpretty.register_uri(
            httpretty.GET,
            "http://autoscalehost.com/datasource/name",
            "result",
        )


        result = client.get("name", "token")