Commits

Anonymous committed 5f070be

tests for delete account

  • Participants
  • Parent commits 6e296cc

Comments (0)

Files changed (1)

File tests/test_views.py

 
 class TestAccount(TestCase):
 
+    def test_delete_account(self):
+
+        response = self.client.get("/acct/delete/")
+        self.assert_401(response)
+
+        user = User(username="tester",
+                    password="test",
+                    email="tester@example.com")
+
+        db.session.add(user)
+        db.session.commit()
+
+        self.login(login="tester@example.com", password="test")
+
+        response = self.client.get("/acct/delete/")
+        self.assert_200(response)
+
+        response = self.client.post("/acct/delete/", 
+                                    data={'recaptcha_challenge_field':'test',
+                                          'recaptcha_response_field':'test'})
+        print response.data
+        self.assert_redirects(response, "/")
+
+        assert User.query.count() == 0
+
+
     def test_login(self):
 
         response = self.client.get("/acct/login/")