added a testcase
@@ -312,10 +312,29 @@ class ViewsTestCase(TestCase):
# expected string is too fragile.
def test_withdraw_application(self):
+ app = ApplicationFactory(
+ status=Application.PENDING,
+ partner=PartnerFactory(authorization_method=Partner.BUNDLE),
+ editor=self.user_editor.editor,
+ )
+
+ factory = RequestFactory()
+ request = factory.get(
+ reverse("users:withdraw", kwargs={"pk": self.editor1.pk, "id": app.pk})
+ )
+ request.user = self.user_editor
+ response = views.WithdrawApplication.as_view()(
+ request, pk=self.editor1.pk, id=app.pk
+ )
+ app.refresh_from_db()
+ self.assertEqual(app.status, Application.INVALID)
+
+ def test_withdraw_sent_application(self):
app = ApplicationFactory(
status=Application.SENT,
partner=PartnerFactory(authorization_method=Partner.BUNDLE),
editor=self.user_editor.editor,
+ sent_by=self.user_coordinator,
)
factory = RequestFactory()
@@ -327,7 +346,6 @@ class ViewsTestCase(TestCase):
request, pk=self.editor1.pk, id=app.pk
)
app.refresh_from_db()
- # self.assertEqual(app.status, Application.INVALID)
self.assertNotIn(app.status, response.render().content.decode("utf-8"))
def test_my_library_page_has_authorizations(self):
