1 from django.test import TestCase
2 from django.test.client import Client
3 from madrona.layer_manager.models import Theme, Layer
4 import simplejson
5
17
19 response = self.client.get(self.url)
20 self.assertEqual(response.status_code, 200, response.status_code)
21 res_str = response.content
22 obj = simplejson.loads(res_str)
23 self.assertEqual(obj["state"]["activeLayers"], [], obj)
24 self.assertEqual(obj["themes"][0]["name"], "Theme1", obj)
25 self.assertEqual(obj["themes"][0]["layers"], [self.layer1.id, self.layer2.id], obj)
26
28 response = self.client.get(self.url)
29 self.assertEqual(response.status_code, 200, response.status_code)
30 res_str = response.content
31 obj = simplejson.loads(res_str)
32 self.assertEqual(obj["state"]["activeLayers"], [], obj)
33
35 response = self.client.get(self.url)
36 self.assertEqual(response.status_code, 200, response.status_code)
37 res_str = response.content
38 obj = simplejson.loads(res_str)
39 self.assertEqual(obj["layers"][0]["name"], "Layer1")
40 for layerid in obj["themes"][0]["layers"]:
41
42 lyr = Layer.objects.get(id=layerid)
43