def setUp(self): self.client = Client() self.user = User.objects.create_user("featuretest", "*****@*****.**", password="******") self.options = Stand.get_options() self.create_url = self.options.get_create_form() self.stand1 = Stand(user=self.user, name="My Stand", geometry_orig=g1) self.stand1.save() self.stand1_form_url = self.options.get_update_form(self.stand1.pk) self.stand1_url = self.stand1.get_absolute_url() enable_sharing()
def setUp(self): self.client = Client() self.user = User.objects.create_user( 'featuretest', '*****@*****.**', password='******') self.options = Stand.get_options() self.create_url = self.options.get_create_form() self.stand1 = Stand(user=self.user, name="My Stand", geometry_orig=g1) self.stand1.save() self.stand1_form_url = self.options.get_update_form(self.stand1.pk) self.stand1_url = self.stand1.get_absolute_url() enable_sharing()
def test_multistand_json_url(self): self.client.login(username="******", password="******") uids = [self.stand1.uid, self.stand2.uid] link = Stand.get_options().get_link("GeoJSON") url = link.reverse([self.stand1, self.stand2]) response = self.client.get(url) self.assertEqual(response.status_code, 200) self.assertTrue("application/json" in response["Content-Type"]) d = loads(response.content) self.assertEquals(len(d["features"]), 2) foundit = False for f in d["features"]: if f["properties"]["name"] == "My Stand2": foundit = True self.assertTrue(foundit)
def test_multistand_json_url(self): self.client.login(username='******', password='******') uids = [self.stand1.uid, self.stand2.uid] link = Stand.get_options().get_link('GeoJSON') url = link.reverse([self.stand1, self.stand2]) response = self.client.get(url) self.assertEqual(response.status_code, 200) self.assertTrue('application/json' in response['Content-Type']) d = loads(response.content) self.assertEquals(len(d['features']), 2) foundit = False for f in d['features']: if f['properties']['name'] == 'My Stand2': foundit = True self.assertTrue(foundit)