Changeset - c76eb3a60f6f
[Not reviewed]
stable
0 1 0
Thomas De Schampheleire - 6 years ago 2020-05-23 20:24:07
thomas.de_schampheleire@nokia.com
tests: actually test something useful in test_edit for gists (Issue #376)

Even though there was a test for editing gists, it did not catch the basic
loading problem reported in issue #376. In fact, the test just loaded the
edit page, but since no user was actually logged in, it just loaded the
login screen. As a result, no real gist editing code was tested at all.

Instead, explicitly check the redirection to a login screen, then proceed
with logging in and check that the edit page can be loaded.

Additionally, don't rely on the magic gist id '1' but create an actual gist
first.

Note: the test does not yet really edit a gist.
1 file changed with 8 insertions and 1 deletions:
0 comments (0 inline, 0 general)
kallithea/tests/functional/test_admin_gists.py
Show inline comments
 
@@ -168,4 +168,11 @@ class TestGistsController(base.TestContr
 
        assert response.body == b'GIST BODY'
 

	
 
    def test_edit(self):
 
        response = self.app.get(base.url('edit_gist', gist_id=1))
 
        gist = _create_gist('gist-edit')
 
        response = self.app.get(base.url('edit_gist', gist_id=gist.gist_access_id), status=302)
 
        assert 'login' in response.location
 

	
 
        self.log_user(base.TEST_USER_REGULAR_LOGIN, base.TEST_USER_REGULAR_PASS)
 
        response = self.app.get(base.url('edit_gist', gist_id=gist.gist_access_id))
 

	
 
        # FIXME actually test editing the gist
0 comments (0 inline, 0 general)