Ejemplo n.º 1
0
 def test_account(self):
     with self.assertRaises(views.ApiError) as context:
         views.sign_in(self.request, self.account.username, self.password,
                       self.building.id)
     self.assertIsNotNone(context.exception.data)
     with self.assertRaises(views.ApiError) as context:
         views.sign_in(self.request, self.account.username, self.password,
                       self.other_building.id)
     self.assertIsNotNone(context.exception.data)
Ejemplo n.º 2
0
 def test_active_staff_and_superuser_account_with_location(self):
     self.update_account(1, 1, 1, location=self.location)
     result = views.sign_in(self.request, self.account.username,
                            self.password, self.building.id)
     self.assertIsNotNone(result['id'])
     result = views.sign_in(self.request, self.account.username,
                            self.password, self.other_building.id)
     self.assertIsNotNone(result['id'])
     self.update_account()
Ejemplo n.º 3
0
 def test_active_superuser_account(self):
     self.update_account(1, 0, 1)
     result = views.sign_in(self.request, self.account.username,
                            self.password, self.building.id)
     self.assertIsNotNone(result['id'])
     result = views.sign_in(self.request, self.account.username,
                            self.password, self.other_building.id)
     self.assertIsNotNone(result['id'])
     self.update_account()
Ejemplo n.º 4
0
 def test_active_account_with_location_and_apartment(self):
     self.update_account(1, 0, 0, location=self.location_with_apartment)
     result = views.sign_in(self.request, self.account.username,
                            self.password, self.building.id)
     self.assertIsNotNone(result['id'])
     with self.assertRaises(views.ApiError) as context:
         views.sign_in(self.request, self.account.username, self.password,
                       self.other_building.id)
     self.assertIsNotNone(context.exception.data)
     self.update_account()
Ejemplo n.º 5
0
 def test_staff_and_superuser_account_with_location(self):
     self.update_account(0, 1, 1, location=self.location)
     with self.assertRaises(views.ApiError) as context:
         views.sign_in(self.request, self.account.username, self.password,
                       self.building.id)
     self.assertIsNotNone(context.exception.data)
     with self.assertRaises(views.ApiError) as context:
         views.sign_in(self.request, self.account.username, self.password,
                       self.other_building.id)
     self.assertIsNotNone(context.exception.data)
     self.update_account()