Merge lp:~facundo/ols-store-tests/store-acceptance-tests--fix-new-format-1 into lp:~ubuntuone-pqm-team/ols-store-tests/store-acceptance-tests

Proposed by Facundo Batista
Status: Merged
Approved by: Ricardo Kirkner
Approved revision: 26
Merged at revision: 26
Proposed branch: lp:~facundo/ols-store-tests/store-acceptance-tests--fix-new-format-1
Merge into: lp:~ubuntuone-pqm-team/ols-store-tests/store-acceptance-tests
Diff against target: 91 lines (+24/-9)
4 files modified
README (+5/-6)
dependencies.txt (+1/-0)
tests/api/snap/helpers.py (+6/-1)
tests/api/snap/test_snap_release.py (+12/-2)
To merge this branch: bzr merge lp:~facundo/ols-store-tests/store-acceptance-tests--fix-new-format-1
Reviewer Review Type Date Requested Status
Ricardo Kirkner (community) Approve
Review via email: mp+303295@code.launchpad.net

This proposal supersedes a proposal from 2016-08-18.

Commit message

Support new format error for Release.

Description of the change

Support new format error for Release.

Also included a couple of small improvements at project level.

To post a comment you must log in.
Revision history for this message
Ricardo Kirkner (ricardokirkner) wrote :

lgtm

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'README'
2--- README 2016-06-29 11:11:11 +0000
3+++ README 2016-08-18 15:26:14 +0000
4@@ -5,7 +5,7 @@
5 0. Setup the environment
6
7 Because the tests rely on certain dependencies that are only available on
8-Ubuntu 16.10 or later, the supported way to run these tests is using LXCs.
9+Ubuntu 16.04 or later, the supported way to run these tests is using LXCs.
10 There's some additional documentation on LXC gotchas in the following
11 page (check there specially if you can't resolve the lxc address when
12 ssh'ing and if you want to open GUI apps seeing them in your host machine):
13@@ -57,11 +57,10 @@
14
15 .. note::
16
17- If you want to run a sub set of the tests only, you can do so providing ARGS, for example
18-
19- $ make api-tests ARGS=-p test_snap_push.py
20-
21- to run only the snap push tests.
22+ If you want to run a sub set of the tests only, you should do...
23+
24+ $ make api-tests TEST_TARGET=tests.api.snap.test_snap_release
25+ $ make api-tests TEST_TARGET=tests.api.snap.test_snap_release.SnapReleaseTestCase.test_release_snap_require_package_upload_permission
26
27 Tests are run against staging by default. If you want to run the tests against a local instance
28 of devportal, you need to:
29
30=== modified file 'dependencies.txt'
31--- dependencies.txt 2016-06-24 20:16:30 +0000
32+++ dependencies.txt 2016-08-18 15:26:14 +0000
33@@ -1,3 +1,4 @@
34+make
35 squashfs-tools
36 snapcraft
37 python3-pymacaroons
38
39=== modified file 'tests/api/snap/helpers.py'
40--- tests/api/snap/helpers.py 2016-06-30 18:47:38 +0000
41+++ tests/api/snap/helpers.py 2016-08-18 15:26:14 +0000
42@@ -177,7 +177,7 @@
43 def assert_require_auth(self, response):
44 self.assertEqual(response.status_code, 401)
45
46- def assert_forbidden(self, response):
47+ def assert_forbidden(self, response, new_style=False):
48 self.assertEqual(response.status_code, 403)
49 body = response.json()
50 expected = {
51@@ -187,6 +187,11 @@
52 "detail": "Permission is required: package_upload",
53 "title": "Macaroon missing required permission.",
54 }
55+ if new_style:
56+ expected["error_list"] = [{
57+ "code": "macaroon-permission-required",
58+ "message": "Permission is required: package_upload",
59+ }]
60 self.assertEqual(body, expected)
61
62 def assert_not_found(self, response):
63
64=== modified file 'tests/api/snap/test_snap_release.py'
65--- tests/api/snap/test_snap_release.py 2016-07-19 11:42:50 +0000
66+++ tests/api/snap/test_snap_release.py 2016-08-18 15:26:14 +0000
67@@ -125,6 +125,16 @@
68 'revision': ['This field is required.'],
69 },
70 'success': False,
71+ 'error_list': [{
72+ 'code': 'missing-field',
73+ 'message': "The 'channels' field is required",
74+ }, {
75+ 'code': 'missing-field',
76+ 'message': "The 'name' field is required",
77+ }, {
78+ 'code': 'missing-field',
79+ 'message': "The 'revision' field is required",
80+ }],
81 }
82 self.assertEqual(body, expected)
83
84@@ -157,5 +167,5 @@
85 auth = authenticate_with_macaroon(permissions=['package_access'])
86 response = release_snap(self.name, self.revision, self.channels,
87 auth=auth)
88- self.assert_error(response)
89- self.assert_forbidden(response)
90+ self.assert_error(response, content_type='application/json')
91+ self.assert_forbidden(response, new_style=True)

Subscribers

People subscribed via source and target branches