Exemplo n.º 1
0
 def test_structure(structure, stake):
     user = self.userfactory(password='******')
     p = user.profile
     p.structure = structure
     p.save()
     success = self.client.login(username=user.username, password='******')
     self.assertTrue(success)
     response = self.client.get(Path.get_add_url())
     self.assertEqual(response.status_code, 200)
     self.assertTrue('form' in response.context)
     form = response.context['form']
     self.assertTrue('stake' in form.fields)
     stakefield = form.fields['stake']
     self.assertTrue((stake.pk, unicode(stake)) in stakefield.choices)
     self.client.logout()
Exemplo n.º 2
0
 def test_structure(structure, stake):
     user = self.userfactory(password='******')
     p = user.profile
     p.structure = structure
     p.save()
     success = self.client.login(username=user.username, password='******')
     self.assertTrue(success)
     response = self.client.get(Path.get_add_url())
     self.assertEqual(response.status_code, 200)
     self.assertTrue('form' in response.context)
     form = response.context['form']
     self.assertTrue('stake' in form.fields)
     stakefield = form.fields['stake']
     self.assertTrue((stake.pk, unicode(stake)) in stakefield.choices)
     self.client.logout()
Exemplo n.º 3
0
 def test_structurerelated_filter_with_none(self):
     s1 = StructureFactory.create()
     s2 = StructureFactory.create()
     st0 = StakeFactory.create(structure=None)
     st1 = StakeFactory.create(structure=s1)
     st2 = StakeFactory.create(structure=s2)
     user = self.userfactory(password='******')
     p = user.profile
     p.structure = s1
     p.save()
     success = self.client.login(username=user.username, password='******')
     self.assertTrue(success)
     response = self.client.get(Path.get_add_url())
     self.assertEqual(response.status_code, 200)
     self.assertTrue('form' in response.context)
     form = response.context['form']
     self.assertTrue('stake' in form.fields)
     stakefield = form.fields['stake']
     self.assertTrue((st0.pk, unicode(st0)) in stakefield.choices)
     self.assertTrue((st1.pk, unicode(st1)) in stakefield.choices)
     self.assertFalse((st2.pk, unicode(st2)) in stakefield.choices)
Exemplo n.º 4
0
 def test_structurerelated_filter_with_none(self):
     s1 = StructureFactory.create()
     s2 = StructureFactory.create()
     st0 = StakeFactory.create(structure=None)
     st1 = StakeFactory.create(structure=s1)
     st2 = StakeFactory.create(structure=s2)
     user = self.userfactory(password='******')
     p = user.profile
     p.structure = s1
     p.save()
     success = self.client.login(username=user.username, password='******')
     self.assertTrue(success)
     response = self.client.get(Path.get_add_url())
     self.assertEqual(response.status_code, 200)
     self.assertTrue('form' in response.context)
     form = response.context['form']
     self.assertTrue('stake' in form.fields)
     stakefield = form.fields['stake']
     self.assertTrue((st0.pk, unicode(st0)) in stakefield.choices)
     self.assertTrue((st1.pk, unicode(st1)) in stakefield.choices)
     self.assertFalse((st2.pk, unicode(st2)) in stakefield.choices)
Exemplo n.º 5
0
 def test_path_form_is_not_valid_if_no_geometry_provided(self):
     self.login()
     data = self.get_good_data()
     data['geom'] = ''
     response = self.client.post(Path.get_add_url(), data)
     self.assertEqual(response.status_code, 200)
Exemplo n.º 6
0
 def test_path_form_is_not_valid_if_no_geometry_provided(self):
     self.login()
     data = self.get_good_data()
     data['geom'] = ''
     response = self.client.post(Path.get_add_url(), data)
     self.assertEqual(response.status_code, 200)