Pass all the test case
@@ -104,7 +104,6 @@ class ViewsTestCase(TestCase):
super(ViewsTestCase, self).setUp()
self.client = Client()
-
# User 1: regular Editor
self.username1 = "alice"
self.user_editor = UserFactory(username=self.username1)
@@ -286,21 +285,8 @@ class ViewsTestCase(TestCase):
partner=PartnerFactory(authorization_method=Partner.BUNDLE),
editor=self.user_editor.editor,
)
- app8 = 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":app8.pk})
- )
- request.user = self.user_editor
- response = views.WithdrawApplication.as_view()(request,pk=self.editor1.pk, id=app8.pk)
-
- self.assertEqual(app8.status,Application.INVALID)
-
request = factory.get(
reverse("users:my_applications", kwargs={"pk": self.editor1.pk})
)
@@ -325,6 +311,23 @@ class ViewsTestCase(TestCase):
# Client), and testing that the rendered content is equal to an
# 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_my_library_page_has_authorizations(self):
# a coordinator with a session.
