You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by br...@apache.org on 2018/04/30 16:27:08 UTC

allura git commit: Fix some tests that started failing after [d55220204]

Repository: allura
Updated Branches:
  refs/heads/master fc13e8104 -> cd89d377b


Fix some tests that started failing after [d55220204]


Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/cd89d377
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/cd89d377
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/cd89d377

Branch: refs/heads/master
Commit: cd89d377b23d109e67cd1b1c777044bf333054eb
Parents: fc13e81
Author: Dave Brondsema <da...@brondsema.net>
Authored: Mon Apr 30 12:26:38 2018 -0400
Committer: Dave Brondsema <da...@brondsema.net>
Committed: Mon Apr 30 12:26:38 2018 -0400

----------------------------------------------------------------------
 Allura/allura/tests/functional/test_auth.py       |  2 +-
 ForgeLink/forgelink/tests/functional/test_root.py | 18 ++++++++----------
 .../forgeshorturl/tests/functional/test.py        | 17 ++++++++---------
 3 files changed, 17 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/cd89d377/Allura/allura/tests/functional/test_auth.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/functional/test_auth.py b/Allura/allura/tests/functional/test_auth.py
index fa7163e..0d0cd36 100644
--- a/Allura/allura/tests/functional/test_auth.py
+++ b/Allura/allura/tests/functional/test_auth.py
@@ -1613,7 +1613,7 @@ class TestOAuth(TestController):
         r = self.app.post('/rest/oauth/request_token', params={'key': 'value'})
         Request.from_request.assert_called_once_with(
             'POST', 'http://localhost/rest/oauth/request_token',
-            headers={'Host': 'localhost:80', 'Content-Type': 'application/x-www-form-urlencoded; charset="utf-8"'},
+            headers={'Host': 'localhost', 'Content-Type': 'application/x-www-form-urlencoded; charset="utf-8"'},
             parameters={'key': 'value'},
             query_string='')
         Server().verify_request.assert_called_once_with(req, consumer_token.consumer, None)

http://git-wip-us.apache.org/repos/asf/allura/blob/cd89d377/ForgeLink/forgelink/tests/functional/test_root.py
----------------------------------------------------------------------
diff --git a/ForgeLink/forgelink/tests/functional/test_root.py b/ForgeLink/forgelink/tests/functional/test_root.py
index 1372be8..6235707 100644
--- a/ForgeLink/forgelink/tests/functional/test_root.py
+++ b/ForgeLink/forgelink/tests/functional/test_root.py
@@ -34,34 +34,32 @@ class TestRootController(TestController):
         response = self.app.get('/admin/link/options', validate_chunk=True)
         response.form['url'] = 'http://www.google.com/'
         response.form.submit()
-        redirected = self.app.get('/link/index').follow()
-        assert redirected.request.url == 'http://www.google.com/'
+        redir = self.app.get('/link/index', status=301)
+        assert_equal(redir.location, 'http://www.google.com/')
 
     @td.with_link
     def test_root_with_url(self):
         response = self.app.get('/admin/link/options', validate_chunk=True)
         response.form['url'] = 'http://www.google.com/'
         response.form.submit()
-        redirected = self.app.get('/link').follow()
-        assert redirected.request.url == 'http://www.google.com/'
+        redir = self.app.get('/link', status=301)
+        assert_equal(redir.location, 'http://www.google.com/')
 
     @td.with_link
     def test_root_suffix_with_url_slash(self):
         response = self.app.get('/admin/link/options', validate_chunk=True)
         response.form['url'] = 'http://www.google.com/'
         response.form.submit()
-        redirected = self.app.get('/link/service')
-        # HACK: support for remote redirects is limited in follow()
-        assert 'http://www.google.com/service' in redirected
+        redir = self.app.get('/link/service', status=301)
+        assert_equal(redir.location, 'http://www.google.com/service')
 
     @td.with_link
     def test_root_suffix_with_url_value(self):
         response = self.app.get('/admin/link/options', validate_chunk=True)
         response.form['url'] = 'http://www.google.de/search?q='
         response.form.submit()
-        response = self.app.get('/link/help')
-        # HACK: support for remote redirects is limited in follow()
-        assert 'http://www.google.de/search?q=help' in response
+        redir = self.app.get('/link/help', status=301)
+        assert_equal(redir.location, 'http://www.google.de/search?q=help')
 
 
 class TestConfigOptions(TestController):

http://git-wip-us.apache.org/repos/asf/allura/blob/cd89d377/ForgeShortUrl/forgeshorturl/tests/functional/test.py
----------------------------------------------------------------------
diff --git a/ForgeShortUrl/forgeshorturl/tests/functional/test.py b/ForgeShortUrl/forgeshorturl/tests/functional/test.py
index 0cc8db3..f2c2e1c 100644
--- a/ForgeShortUrl/forgeshorturl/tests/functional/test.py
+++ b/ForgeShortUrl/forgeshorturl/tests/functional/test.py
@@ -42,25 +42,24 @@ class TestRootController(TestController):
         response.form['short_url'] = 'test'
         response.form['full_url'] = 'http://www.google.com/'
         response.form.submit()
-        redirected = self.app.get('/url/test').follow()
-        assert redirected.request.url == 'http://www.google.com/'
+        redir = self.app.get('/url/test', status=302)
+        assert_equal(redir.location, 'http://www.google.com/')
 
     def test_shorturl_http_head(self):
         response = self.app.get('/admin/url/add')
         response.form['short_url'] = 'test'
         response.form['full_url'] = 'http://www.google.com/'
         response.form.submit()
-        r = self.app.head('/url/test')
-        assert r.status_int == 302
-        assert r.headers['Location'] == 'http://www.google.com/'
+        r = self.app.head('/url/test', status=302)
+        assert_equal(r.location, 'http://www.google.com/')
 
     def test_shorturl_update(self):
         response = self.app.get('/admin/url/add')
         response.form['short_url'] = 'g'
         response.form['full_url'] = 'http://www.google.com/'
         response.form.submit()
-        redirected = self.app.get('/url/g').follow()
-        assert redirected.request.url == 'http://www.google.com/'
+        redir = self.app.get('/url/g', status=302)
+        assert_equal(redir.location, 'http://www.google.com/')
 
         response = self.app.get('/url/')
         form = response.forms['short-url-form']
@@ -69,8 +68,8 @@ class TestRootController(TestController):
         form['full_url'] = 'http://www.yahoo.com/'
         form.action = '/admin/url/add/'
         form.submit()
-        redirected = self.app.get('/url/g').follow()
-        assert_equal(redirected.request.url, 'http://www.yahoo.com/')
+        redir = self.app.get('/url/g', status=302)
+        assert_equal(redir.location, 'http://www.yahoo.com/')
 
     def test_shorturl_not_found(self):
         self.app.post('/admin/url/add',