12119.1.19
by Tim Penhey
Redirection tests for the builder set. |
1 |
# Copyright 2010 Canonical Ltd. This software is licensed under the
|
2 |
# GNU Affero General Public License version 3 (see the file LICENSE).
|
|
3 |
||
4 |
"""Tests for the lp.soyuz.browser.builder module."""
|
|
5 |
||
6 |
__metaclass__ = type |
|
7 |
||
14600.2.2
by Curtis Hovey
Moved webapp to lp.services. |
8 |
from lp.services.webapp import canonical_url |
12119.1.19
by Tim Penhey
Redirection tests for the builder set. |
9 |
from canonical.testing.layers import DatabaseFunctionalLayer |
10 |
from lp.testing import TestCaseWithFactory |
|
11 |
from lp.testing.publication import test_traverse |
|
12 |
||
13 |
||
14 |
class TestBuildersNavigation(TestCaseWithFactory): |
|
15 |
||
16 |
layer = DatabaseFunctionalLayer |
|
17 |
||
18 |
def test_buildjob_redirects_for_recipe_build(self): |
|
12119.1.26
by Tim Penhey
Update some comments to add the + |
19 |
# /builders/+buildjob/<job id> redirects to the build page.
|
12119.1.19
by Tim Penhey
Redirection tests for the builder set. |
20 |
build = self.factory.makeSourcePackageRecipeBuild() |
12957.1.5
by William Grant
Unbreak tests. |
21 |
url = 'http://launchpad.dev/builders/+buildjob/%s' % ( |
22 |
build.build_farm_job.id) |
|
12119.1.19
by Tim Penhey
Redirection tests for the builder set. |
23 |
context, view, request = test_traverse(url) |
24 |
view() |
|
25 |
self.assertEqual(301, request.response.getStatus()) |
|
26 |
self.assertEqual( |
|
27 |
canonical_url(build), |
|
28 |
request.response.getHeader('location')) |
|
29 |
||
30 |
def test_buildjob_redirects_for_binary_build(self): |
|
12119.1.26
by Tim Penhey
Update some comments to add the + |
31 |
# /builders/+buildjob/<job id> redirects to the build page.
|
12119.1.19
by Tim Penhey
Redirection tests for the builder set. |
32 |
build = self.factory.makeBinaryPackageBuild() |
12957.1.5
by William Grant
Unbreak tests. |
33 |
url = 'http://launchpad.dev/builders/+buildjob/%s' % ( |
34 |
build.build_farm_job.id) |
|
12119.1.19
by Tim Penhey
Redirection tests for the builder set. |
35 |
context, view, request = test_traverse(url) |
36 |
view() |
|
37 |
self.assertEqual(301, request.response.getStatus()) |
|
38 |
self.assertEqual( |
|
39 |
canonical_url(build), |
|
40 |
request.response.getHeader('location')) |