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)
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()
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()
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()
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()