Introduce user_deletion test.
authorSebastian Spaeth <Sebastian@SSpaeth.de>
Thu, 17 Jan 2013 11:19:16 +0000 (12:19 +0100)
committerSebastian Spaeth <Sebastian@SSpaeth.de>
Thu, 17 Jan 2013 11:19:52 +0000 (12:19 +0100)
Delete a user via web interface and see if it works. TODO: this does not test
that related entries are also cleaned up and we should extend the test to
do so.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
mediagoblin/tests/test_edit.py

index cbdad64976759fce97b71dfa882d93f10fa0fb19..4bea9243fd426dc2d7bb928b8d2a2db07074ef18 100644 (file)
@@ -37,6 +37,24 @@ class TestUserEdit(object):
                 'password': self.user_password})
 
 
+    def test_user_deletion(self):
+        """Delete user via web interface"""
+        # Make sure user exists
+        assert User.query.filter_by(username=u'chris').first()
+
+        res = self.app.post('/edit/account/delete/', {'confirmed': 'y'})
+
+        # Make sure user has been deleted
+        assert User.query.filter_by(username=u'chris').first() == None
+
+        #TODO: make sure all corresponding items comments etc have been
+        # deleted too. Perhaps in submission test?
+
+        #Restore user at end of test
+        self.user = fixture_add_user(password = self.user_password)
+        self.login()
+
+
     def test_change_password(self):
         """Test changing password correctly and incorrectly"""
         # test that the password can be changed