Fix tests to test new behavior

Signed-off-by: Paul Konstantin Gerke <paulkgerke@craftware.info>
This commit is contained in:
Paul Konstantin Gerke 2022-01-12 00:28:27 +01:00 committed by Christopher Charbonneau Wells
parent c1a0abd1f7
commit 5e1248e798
1 changed files with 6 additions and 14 deletions

View File

@ -406,29 +406,21 @@ class TimerAPITestCase(TestBase.BabyBuddyAPITestCaseBase):
response = self.client.patch(f"{endpoint}restart/")
self.assertEqual(response.status_code, status.HTTP_200_OK)
self.assertTrue(response.data["active"])
response = self.client.get(endpoint)
# Restart twice is allowed
response = self.client.patch(f"{endpoint}restart/")
self.assertEqual(response.status_code, status.HTTP_200_OK)
self.assertTrue(response.data["active"])
# Restart twice fails
response = self.client.patch(f"{endpoint}restart/")
self.assertEqual(
response.status_code, status.HTTP_412_PRECONDITION_FAILED
)
response = self.client.patch(f"{endpoint}stop/")
self.assertEqual(response.status_code, status.HTTP_200_OK)
response = self.client.get(endpoint)
self.assertEqual(response.status_code, status.HTTP_200_OK)
self.assertFalse(response.data["active"])
# Stopping twice fails
# Stopping twice is allowed, too
response = self.client.patch(f"{endpoint}stop/")
self.assertEqual(
response.status_code, status.HTTP_412_PRECONDITION_FAILED
)
self.assertEqual(response.status_code, status.HTTP_200_OK)
self.assertFalse(response.data["active"])
class TummyTimeAPITestCase(TestBase.BabyBuddyAPITestCaseBase):