Exemplo n.º 1
0
 def test_get_authorized_structures_superuser(self):
     admin_user = User.objects.create_superuser('admin',
                                                email='*****@*****.**',
                                                password='******')
     active_structures = Structure.objects.filter(is_active=True)
     self.assertEqual(len(get_authorized_structures_ids(admin_user)[0]),
                      len(active_structures))
Exemplo n.º 2
0
 def test_get_authorized_structures_ids_with_hierarchy(self):
     user = User.objects.get(pk=100)
     self.assertSetEqual(get_authorized_structures_ids(user)[1], {4, 1})
Exemplo n.º 3
0
 def test_get_authorized_structures_ids(self):
     user = User.objects.get(pk=100)
     self.assertSetEqual(get_authorized_structures_ids(user)[0], {4})