Skip to content
Permalink
Browse files

Add a test for the old url redirect.

  • Loading branch information...
ralphbean committed Sep 15, 2015
1 parent d25abe4 commit 1db0435f7c6a35f7f7ae5179dcf65764c2b8f1f1
Showing with 20 additions and 0 deletions.
  1. +20 −0 bodhi/tests/functional/test_updates.py
@@ -337,6 +337,26 @@ def test_provenpackager_request_privs(self, publish, *args):
res = app.get('/updates/%s' % nvr, status=200)
eq_(res.json_body['can_edit'], False)

@mock.patch(**mock_valid_requirements)
@mock.patch('bodhi.notifications.publish')
def test_old_bodhi1_redirect(self, publish, *args):
# Create it
title = 'bodhi-2.0.0-1.fc17'
self.app.post_json('/updates/', self.get_update(title))
publish.assert_called_once_with(
topic='update.request.testing', msg=mock.ANY)

# Get it once with just the title
url = '/updates/%s' % title
res = self.app.get(url)
update = res.json_body['update']

# Now try the old bodhi1 url. Redirect should take place.
url = '/updates/%s/%s' % (update['alias'], update['title'])
res = self.app.get(url, status=302)
target = 'http://localhost/updates/%s' % update['alias']
self.assertEquals(res.headers['Location'], target)

@mock.patch(**mock_valid_requirements)
def test_pkgdb_outage(self, *args):
"Test the case where our call to the pkgdb throws an exception"

0 comments on commit 1db0435

Please sign in to comment.
You can’t perform that action at this time.