Merge lp:~vila/ols-store-tests/fix-arch-requirement into lp:~ubuntuone-pqm-team/ols-store-tests/store-acceptance-tests

Proposed by Vincent Ladeuil
Status: Merged
Approved by: Vincent Ladeuil
Approved revision: 46
Merge reported by: Otto Co-Pilot
Merged at revision: not available
Proposed branch: lp:~vila/ols-store-tests/fix-arch-requirement
Merge into: lp:~ubuntuone-pqm-team/ols-store-tests/store-acceptance-tests
Diff against target: 49 lines (+11/-6)
1 file modified
tests/api/cpi/test_snaps.py (+11/-6)
To merge this branch: bzr merge lp:~vila/ols-store-tests/fix-arch-requirement
Reviewer Review Type Date Requested Status
William Grant code Approve
Review via email: mp+321818@code.launchpad.net

Commit message

X-Ubuntu-Architecture requirement is more precise now.

Description of the change

X-Ubuntu-Architecture requirement is more precise now.

To post a comment you must log in.
Revision history for this message
William Grant (wgrant) :
review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tests/api/cpi/test_snaps.py'
2--- tests/api/cpi/test_snaps.py 2017-03-21 10:05:43 +0000
3+++ tests/api/cpi/test_snaps.py 2017-04-04 07:31:37 +0000
4@@ -11,7 +11,7 @@
5 from .test_search import SearchTestCase
6
7
8-def get_snap_detail(name, series='16', arch='amd64', auth=False):
9+def get_snap_detail(name, series='16', arch='amd64', auth=False, params=None):
10 url = '{}/api/v1/snaps/details/{}'.format(CPI_ROOT_URL, name)
11 headers = {}
12 if arch:
13@@ -20,14 +20,16 @@
14 headers['X-Ubuntu-Series'] = series
15 if auth:
16 with get_oauth_client() as client:
17- response = client.get(url, headers=headers)
18+ response = client.get(url, headers=headers, params=params)
19 else:
20- response = requests.get(url, headers=headers)
21+ response = requests.get(url, headers=headers, params=params)
22 return response
23
24
25 class SnapDetailTestCase(APITestCase):
26
27+ maxDiff = None
28+
29 def assert_snap_detail(self, response, name):
30 body = response.json()
31 fields = [
32@@ -106,11 +108,14 @@
33 message='X-Ubuntu-Series header is required.',
34 new_style_error=True)
35
36- def test_get_snap_detail_without_arch(self):
37- response = get_snap_detail(SNAP_PACKAGE_NAME, arch=None)
38+ def test_get_snap_detail_with_channel_maps_without_arch(self):
39+ response = get_snap_detail(
40+ SNAP_PACKAGE_NAME, arch=None,
41+ params={'fields': 'name,channel,channel_maps_list'})
42 self.assert_bad_request(
43 response, code='missing-header',
44- message='X-Ubuntu-Architecture header is required.',
45+ message=('X-Ubuntu-Architecture header is mandatory when'
46+ ' the channel_maps_list field is requested'),
47 new_style_error=True)
48
49 def test_get_snap_detail_unauthorized(self):

Subscribers

People subscribed via source and target branches