def test_worse_than_OK_but_better_than_soft(self): with patch( "contentcuration.views.internal.VERSION_OK", internal.VersionStatus(version="1.0.0", status=0, message=rc.VERSION_OK_MESSAGE), ), patch( "contentcuration.views.internal.VERSION_SOFT_WARNING", internal.VersionStatus( version="0.0.1", status=1, message=rc.VERSION_SOFT_WARNING_MESSAGE), ): response = self.post(reverse_lazy("check_version"), {"version": "0.1.1"}) self.assertEqual(response.status_code, 200) self.assertTrue(response.json()["success"]) self.assertEqual(response.json()["status"], internal.VERSION_SOFT_WARNING[1])
def test_worse_than_hard(self): with patch( "contentcuration.views.internal.VERSION_HARD_WARNING", internal.VersionStatus( version="1.0.0", status=2, message=rc.VERSION_HARD_WARNING_MESSAGE), ): response = self.post(reverse_lazy("check_version"), {"version": "0.1.1"}) self.assertEqual(response.status_code, 200) self.assertTrue(response.json()["success"]) self.assertEqual(response.json()["status"], internal.VERSION_ERROR[1])