Example #1
0
 def test_signage_type_change_not_same_structure(self):
     self.login()
     structure = StructureFactory(name="Other")
     signagetype = SignageTypeFactory.create(structure=structure)
     change_url = reverse('admin:signage_signagetype_change', args=[signagetype.pk])
     response = self.client.get(change_url)
     self.assertEqual(response.status_code, 200)
     self.assertContains(response, '<select name="structure" id="id_structure">')
Example #2
0
 def test_signage_type_change_not_same_structure(self):
     self.login()
     structure = StructureFactory(name="Other")
     signagetype = SignageTypeFactory.create(structure=structure)
     change_url = reverse('admin:signage_signagetype_change', args=[signagetype.pk])
     response = self.client.get(change_url)
     self.assertEquals(response.status_code, 200)
     self.assertIn('<select name="structure" id="id_structure">', response.content)
 def test_check_structure_or_none_related_are_visible(self):
     self.login()
     signagetype = SignageTypeFactory.create(structure=None)
     response = self.client.get(self.model.get_add_url())
     self.assertEqual(response.status_code, 200)
     self.assertTrue('form' in response.context)
     form = response.context['form']
     type = form.fields['type']
     self.assertTrue((signagetype.pk, str(signagetype)) in type.choices)
Example #4
0
 def get_good_data(self):
     path = PathFactory.create()
     return {
         'name': 'test',
         'description': 'oh',
         'type': SignageTypeFactory.create().pk,
         'condition': InfrastructureConditionFactory.create().pk,
         'topology': '{"paths": [%s]}' % path.pk,
     }
Example #5
0
 def test_check_structure_or_none_related_are_visible(self):
     self.login()
     signagetype = SignageTypeFactory.create(structure=None)
     response = self.client.get(self.model.get_add_url())
     self.assertEqual(response.status_code, 200)
     self.assertTrue('form' in response.context)
     form = response.context['form']
     type = form.fields['type']
     self.assertTrue((signagetype.pk, unicode(signagetype)) in type.choices)
Example #6
0
 def get_good_data(self):
     path = PathFactory.create()
     return {
         'name': 'test',
         'description': 'oh',
         'type': SignageTypeFactory.create().pk,
         'condition': InfrastructureConditionFactory.create().pk,
         'topology': '{"paths": [%s]}' % path.pk,
     }
Example #7
0
    def test_signage_type_change_not_same_structure(self):
        self.login()
        structure = StructureFactory(name="Other")
        infra = SignageTypeFactory.create(structure=structure)
        change_url = reverse('admin:signage_signagetype_change', args=[infra.pk])
        response = self.client.get(change_url)
        self.assertEqual(response.status_code, 302)
        self.assertEqual(SignageType.objects.get(pk=self.signa.pk).label, self.signa.label)

        self.assertEqual(response.url, '/admin/')
Example #8
0
    def test_signage_type_change_not_same_structure(self):
        self.login()
        structure = StructureFactory(name="Other")
        infra = SignageTypeFactory.create(structure=structure)
        change_url = reverse('admin:signage_signagetype_change', args=[infra.pk])
        response = self.client.get(change_url)
        self.assertEquals(response.status_code, 302)
        self.assertEqual(SignageType.objects.get(pk=self.signa.pk).label, self.signa.label)

        self.assertEqual(response.url, '/admin/')
Example #9
0
 def setUp(self):
     self.user = UserFactory.create(password='******')
     self.client.login(username=self.user.username, password='******')
     for perm in Permission.objects.exclude(codename='can_bypass_structure'):
         self.user.user_permissions.add(perm)
     self.user.is_staff = True
     self.user.save()
     p = self.user.profile
     structure = StructureFactory(name="This")
     p.structure = structure
     p.save()
     self.signa = SignageTypeFactory.create(structure=structure)
Example #10
0
 def setUp(self):
     self.user = UserFactory.create(password='******')
     self.client.login(username=self.user.username, password='******')
     for perm in Permission.objects.exclude(codename='can_bypass_structure'):
         self.user.user_permissions.add(perm)
     self.user.is_staff = True
     self.user.save()
     p = self.user.profile
     structure = StructureFactory(name="This")
     p.structure = structure
     p.save()
     self.signa = SignageTypeFactory.create(structure=structure)
 def get_good_data(self):
     good_data = {
         'name': 'test',
         'description': 'oh',
         'type': SignageTypeFactory.create().pk,
         'condition': InfrastructureConditionFactory.create().pk,
     }
     if settings.TREKKING_TOPOLOGY_ENABLED:
         path = PathFactory.create()
         good_data['topology'] = '{"paths": [%s]}' % path.pk
     else:
         good_data['geom'] = 'POINT(0.42 0.666)'
     return good_data