예제 #1
0
    def test_manager(self):
        it1 = InfrastructureConditionFactory.create()
        it2 = InfrastructureConditionFactory.create()
        it3 = InfrastructureConditionFactory.create()

        self.assertCountEqual(InfrastructureCondition.objects.all(),
                              [it1, it2, it3])
예제 #2
0
 def get_good_data(self):
     PathFactory.create()
     return {
         'name': 'test',
         'description': 'oh',
         'type': InfrastructureTypeFactory.create(type=INFRASTRUCTURE_TYPES.BUILDING).pk,
         'condition': InfrastructureConditionFactory.create().pk,
         'topology': '{"lat": 0.42, "lng": 0.666}'
     }
예제 #3
0
 def get_good_data(self):
     path = PathFactory.create()
     return {
         'name': 'test',
         'description': 'oh',
         'type': InfrastructureTypeFactory.create(type=INFRASTRUCTURE_TYPES.BUILDING).pk,
         'condition': InfrastructureConditionFactory.create().pk,
         'topology': '{"paths": [%s]}' % path.pk,
     }
예제 #4
0
 def get_good_data(self):
     PathFactory.create()
     return {
         'name': 'test',
         'description': 'oh',
         'structure': default_structure().pk,
         'type': InfrastructureTypeFactory.create(type=INFRASTRUCTURE_TYPES.BUILDING).pk,
         'condition': InfrastructureConditionFactory.create().pk,
         'topology': '{"lat": 0.42, "lng": 0.666}'
     }
예제 #5
0
 def get_good_data(self):
     path = PathFactory.create()
     return {
         'name': 'test',
         'description': 'oh',
         'structure': default_structure().pk,
         'type': InfrastructureTypeFactory.create(type=INFRASTRUCTURE_TYPES.BUILDING).pk,
         'condition': InfrastructureConditionFactory.create().pk,
         'topology': '{"paths": [%s]}' % path.pk,
     }
예제 #6
0
    def test_infrastructurecondition_cannot_be_change_not_same_structure(self):
        self.login()
        structure = StructureFactory(name="Other")
        infra = InfrastructureConditionFactory.create(structure=structure)
        change_url = reverse('admin:infrastructure_infrastructurecondition_change', args=[infra.pk])
        response = self.client.get(change_url)
        self.assertEqual(response.status_code, 302)
        self.assertEqual(InfrastructureCondition.objects.get(pk=self.infra.pk).label, self.infra.label)

        self.assertEqual(response.url, '/admin/')
예제 #7
0
    def test_infrastructurecondition_cannot_be_change_not_same_structure(self):
        self.login()
        structure = StructureFactory(name="Other")
        infra = InfrastructureConditionFactory.create(structure=structure)
        change_url = reverse('admin:infrastructure_infrastructurecondition_change', args=[infra.pk])
        response = self.client.get(change_url)
        self.assertEquals(response.status_code, 302)
        self.assertEqual(InfrastructureCondition.objects.get(pk=self.infra.pk).label, self.infra.label)

        self.assertEqual(response.url, '/admin/')
예제 #8
0
 def setUp(self):
     self.user = UserFactory.create(password='******')
     self.client.login(username=self.user.username, password='******')
     self.user.user_permissions.add(Permission.objects.get(codename='add_draft_path'))
     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.infra = InfrastructureConditionFactory.create(structure=structure)
예제 #9
0
 def setUp(self):
     self.user = UserFactory.create(password='******')
     self.client.login(username=self.user.username, password='******')
     self.user.user_permissions.add(Permission.objects.get(codename='add_draft_path'))
     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.infra = InfrastructureConditionFactory.create(structure=structure)
예제 #10
0
 def get_good_data(self):
     good_data = {
         'name':
         'test',
         'description':
         'oh',
         'type':
         InfrastructureTypeFactory.create(
             type=INFRASTRUCTURE_TYPES.BUILDING).pk,
         'condition':
         InfrastructureConditionFactory.create().pk,
     }
     if settings.TREKKING_TOPOLOGY_ENABLED:
         path = PathFactory.create()
         good_data['topology'] = '{"paths": [%s]}' % path.pk
     else:
         good_data['geom'] = 'LINESTRING (0.0 0.0, 1.0 1.0)'
     return good_data
예제 #11
0
 def get_good_data(self):
     data = super(SignageViewsTest, self).get_good_data()
     data['type'] = InfrastructureTypeFactory.create(type=INFRASTRUCTURE_TYPES.SIGNAGE).pk
     data['condition'] = InfrastructureConditionFactory.create().pk
     return data
예제 #12
0
    def test_manager(self):
        it1 = InfrastructureConditionFactory.create()
        it2 = InfrastructureConditionFactory.create()
        it3 = InfrastructureConditionFactory.create()

        self.assertItemsEqual(InfrastructureCondition.objects.all(), [it1, it2, it3])
예제 #13
0
 def get_good_data(self):
     data = super(SignageViewsTest, self).get_good_data()
     data['type'] = InfrastructureTypeFactory.create(type=INFRASTRUCTURE_TYPES.SIGNAGE).pk
     data['condition'] = InfrastructureConditionFactory.create().pk
     return data
예제 #14
0
 def setUp(self):
     self.user = SuperUserFactory.create(password='******')
     self.infra = InfrastructureConditionFactory.create()
예제 #15
0
 def setUp(self):
     self.user = SuperUserFactory.create(password='******')
     self.infra = InfrastructureConditionFactory.create()