# Path: tsuru_autoscale/alarm/forms.py
# class AlarmForm(forms.Form):
#     name = forms.CharField()
#     expression = forms.CharField()
#     enabled = forms.BooleanField(initial=True)
#     wait = forms.IntegerField()
#     datasource = forms.ChoiceField()
#     actions = forms.MultipleChoiceField()
#     instance = forms.ChoiceField()
# 
# Path: tsuru_autoscale/alarm/client.py
# def host():
# def new(data, token):
# def list(token):
# def remove(name, token):
# def get(name, token):
# def service_instance_list(token):


from django.test import TestCase
from django.core.urlresolvers import reverse
from tsuru_autoscale.alarm.forms import AlarmForm
from tsuru_autoscale.alarm import client
import httpretty
import mock
import os
            'instance': 'bla',
        }

        url = "{}?TSURU_TOKEN=bla".format(reverse("alarm-new"))
        response = self.client.post(url, data)

        url = "{}?TSURU_TOKEN=bla".format(reverse("alarm-list"))
        self.assertRedirects(response, url)
        new_mock.assert_called_with(data, "bla")


class ListTestCase(TestCase):
    @mock.patch("tsuru_autoscale.alarm.client.list")
    def test_list(self, list_mock):
        url = "{}?TSURU_TOKEN=bla".format(reverse("alarm-list"))
        response = self.client.get(url)

        self.assertTemplateUsed(response, "alarm/list.html")
        self.assertIn('list', response.context)
        list_mock.assert_called_with("bla")


class GetTestCase(TestCase):
    @mock.patch("tsuru_autoscale.alarm.client.get")
    def test_get(self, get_mock):
        result_mock = mock.Mock()
        result_mock.json.return_value = {"name": "ble"}
        get_mock.return_value = result_mock

        url = "{}?TSURU_TOKEN=bla".format(reverse("alarm-get", args=["ble"]))

# Path: tsuru_autoscale/alarm/forms.py
# class AlarmForm(forms.Form):
#     name = forms.CharField()
#     expression = forms.CharField()
#     enabled = forms.BooleanField(initial=True)
#     wait = forms.IntegerField()
#     datasource = forms.ChoiceField()
#     actions = forms.MultipleChoiceField()
#     instance = forms.ChoiceField()
# 
# Path: tsuru_autoscale/alarm/client.py
# def host():
# def new(data, token):
# def list(token):
# def remove(name, token):
# def get(name, token):
# def service_instance_list(token):


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

            'instance': 'bla',
        }

        url = "{}?TSURU_TOKEN=bla".format(reverse("alarm-new"))
        response = self.client.post(url, data)

        url = "{}?TSURU_TOKEN=bla".format(reverse("alarm-list"))
        self.assertRedirects(response, url)
        new_mock.assert_called_with(data, "bla")


class ListTestCase(TestCase):
    @mock.patch("tsuru_autoscale.alarm.client.list")
    def test_list(self, list_mock):
        url = "{}?TSURU_TOKEN=bla".format(reverse("alarm-list"))
        response = self.client.get(url)

        self.assertTemplateUsed(response, "alarm/list.html")
        self.assertIn('list', response.context)
        list_mock.assert_called_with("bla")


class GetTestCase(TestCase):
    @mock.patch("tsuru_autoscale.alarm.client.get")
    def test_get(self, get_mock):
        result_mock = mock.Mock()
        result_mock.json.return_value = {"name": "ble"}
        get_mock.return_value = result_mock

        url = "{}?TSURU_TOKEN=bla".format(reverse("alarm-get", args=["ble"]))

        response = self.client.get(url)