11822.3.2
by Edwin Grubbs
Fixed lint. |
1 |
Distributions |
2 |
============= |
|
6988.2.1
by Guilherme Salgado
Publish the very basic bits of IDistribution and IDistributionSet plus a few minor improvements. |
3 |
|
4 |
At the top level we provide the collection of all distributions, with |
|
5 |
Ubuntu and its flavours being the first on the list. |
|
6 |
||
7 |
>>> distros = webservice.get("/distros").jsonBody() |
|
8 |
>>> for entry in distros['entries']: |
|
9 |
... print entry['self_link'] |
|
10 |
http://.../ubuntu |
|
11 |
http://.../kubuntu |
|
12 |
http://.../ubuntutest |
|
13 |
http://.../debian |
|
14 |
http://.../gentoo |
|
15 |
||
16 |
And for every distribution we publish most of its attributes. |
|
17 |
||
8122.4.5
by Leonard Richardson
Switched over to the new testing.webservice file. |
18 |
>>> from lazr.restful.testing.webservice import pprint_entry |
6988.2.1
by Guilherme Salgado
Publish the very basic bits of IDistribution and IDistributionSet plus a few minor improvements. |
19 |
>>> distro = distros['entries'][0] |
20 |
>>> ubuntu = webservice.get(distro['self_link']).jsonBody() |
|
7370.1.2
by Leonard Richardson
Ported some more tests. |
21 |
>>> pprint_entry(ubuntu) |
6988.2.1
by Guilherme Salgado
Publish the very basic bits of IDistribution and IDistributionSet plus a few minor improvements. |
22 |
active: True |
7370.1.2
by Leonard Richardson
Ported some more tests. |
23 |
active_milestones_collection_link: u'http://.../ubuntu/active_milestones' |
24 |
all_milestones_collection_link: u'http://.../ubuntu/all_milestones' |
|
10236.2.8
by Jonathan Davies
Corrected links in distribution tests. |
25 |
archive_mirrors_collection_link: u'http://.../ubuntu/archive_mirrors' |
7370.1.2
by Leonard Richardson
Ported some more tests. |
26 |
archives_collection_link: u'http://.../ubuntu/archives' |
7675.712.2
by Abel Deuring
add the property bug_reported_acknowledgement to class DistributionSourcePackageInDatabase; fix a number of failing tests |
27 |
bug_reported_acknowledgement: None |
7368.5.7
by Gavin Panella
Fix some encoding/decoding inconsistencies, and update the tests for bug_reporting_guidelines. |
28 |
bug_reporting_guidelines: None |
10774.2.9
by Cody A.W. Somerville
Fix registry webservice doctests for projects and distributions. |
29 |
bug_supervisor_link: None |
10236.2.8
by Jonathan Davies
Corrected links in distribution tests. |
30 |
cdimage_mirrors_collection_link: u'http://.../ubuntu/cdimage_mirrors' |
7370.1.2
by Leonard Richardson
Ported some more tests. |
31 |
current_series_link: u'http://.../ubuntu/hoary' |
32 |
date_created: u'2006-10-16T18:31:43.415195+00:00' |
|
12768.2.3
by Raphael Badin
Fix distribution test. |
33 |
derivatives_collection_link: u'http://.../ubuntu/derivatives' |
7370.1.2
by Leonard Richardson
Ported some more tests. |
34 |
description: u'Ubuntu is a new approach...' |
35 |
display_name: u'Ubuntu' |
|
36 |
domain_name: u'ubuntulinux.org' |
|
6988.2.1
by Guilherme Salgado
Publish the very basic bits of IDistribution and IDistributionSet plus a few minor improvements. |
37 |
driver_link: None |
38 |
homepage_content: None |
|
7370.1.2
by Leonard Richardson
Ported some more tests. |
39 |
icon_link: u'http://.../ubuntu/icon' |
40 |
logo_link: u'http://.../ubuntu/logo' |
|
41 |
main_archive_link: u'http://.../ubuntu/+archive/primary' |
|
10236.2.8
by Jonathan Davies
Corrected links in distribution tests. |
42 |
mirror_admin_link: u'http://.../~ubuntu-mirror-admins' |
7370.1.2
by Leonard Richardson
Ported some more tests. |
43 |
mugshot_link: u'http://.../ubuntu/mugshot' |
44 |
name: u'ubuntu' |
|
7949.2.3
by Tom Berger
make it possible to access and manipulate official tags as a list, and some other improvements |
45 |
official_bug_tags: [] |
7370.1.2
by Leonard Richardson
Ported some more tests. |
46 |
owner_link: u'http://.../~ubuntu-team' |
7675.1066.3
by Raphael Badin
Fixed tests impacted by the addition of the registrant field and the display fix. |
47 |
registrant_link: u'http://.../~registry' |
7370.1.2
by Leonard Richardson
Ported some more tests. |
48 |
resource_type_link: u'http://.../#distribution' |
10774.2.9
by Cody A.W. Somerville
Fix registry webservice doctests for projects and distributions. |
49 |
security_contact_link: None |
7370.1.2
by Leonard Richardson
Ported some more tests. |
50 |
self_link: u'http://.../ubuntu' |
51 |
series_collection_link: u'http://.../ubuntu/series' |
|
52 |
summary: u'Ubuntu is a new approach to Linux Distribution...' |
|
53 |
title: u'Ubuntu Linux' |
|
12243.5.6
by Leonard Richardson
Got another batch of tests to pass. |
54 |
web_link: u'http://launchpad.../ubuntu' |
7310.3.2
by Julian Edwards
Allow webservice access to distroseries from distributions. |
55 |
|
56 |
||
11822.3.2
by Edwin Grubbs
Fixed lint. |
57 |
Distribution Custom Operations |
58 |
============================== |
|
7310.3.2
by Julian Edwards
Allow webservice access to distroseries from distributions. |
59 |
|
60 |
Distribution has some custom operations. |
|
61 |
||
62 |
"getSeries" returns the named distribution series for the distribution. |
|
63 |
||
7310.3.6
by Julian Edwards
re-enable some tests |
64 |
>>> series = webservice.named_get( |
65 |
... ubuntu['self_link'], 'getSeries', |
|
66 |
... name_or_version='hoary').jsonBody() |
|
67 |
>>> print series['self_link'] |
|
68 |
http://.../ubuntu/hoary |
|
7310.3.2
by Julian Edwards
Allow webservice access to distroseries from distributions. |
69 |
|
13228.3.1
by Francis J. Lacoste
Make NoSuchDistroSeries map to 404 instead of 400. |
70 |
Requesting a series that does not exist is results in a not found error. |
8357.2.1
by Curtis Hovey
Fixed distribution.getSeries error to return 400 for API. Exposed milestone.product_release to the API. |
71 |
|
72 |
>>> print webservice.named_get( |
|
73 |
... ubuntu['self_link'], 'getSeries', |
|
74 |
... name_or_version='fnord') |
|
13228.3.1
by Francis J. Lacoste
Make NoSuchDistroSeries map to 404 instead of 400. |
75 |
HTTP/1.1 404 Not Found |
8357.2.1
by Curtis Hovey
Fixed distribution.getSeries error to return 400 for API. Exposed milestone.product_release to the API. |
76 |
... |
12361.1.7
by Tim Penhey
Fix the traceback removal on the webservice tests. |
77 |
No such distribution series: 'fnord'. |
8357.2.1
by Curtis Hovey
Fixed distribution.getSeries error to return 400 for API. Exposed milestone.product_release to the API. |
78 |
|
7310.3.2
by Julian Edwards
Allow webservice access to distroseries from distributions. |
79 |
"getDevelopmentSeries" returns all the distribution series for the |
80 |
distribution that are marked as in development. |
|
81 |
||
82 |
>>> dev_series = webservice.named_get( |
|
83 |
... ubuntu['self_link'], 'getDevelopmentSeries').jsonBody() |
|
84 |
>>> for entry in sorted(dev_series['entries']): |
|
85 |
... print entry['self_link'] |
|
86 |
http://.../ubuntu/hoary |
|
87 |
||
8357.2.5
by Curtis Hovey
Added addtional tests to verify that None is returned for a bad milestone lookup. |
88 |
"getMilestone" returns a milestone for the given name, or None if there |
89 |
is no milestone for the given name. |
|
8357.2.3
by Curtis Hovey
Exposed Product/Project/Distribution getMilestone to the API. |
90 |
|
91 |
>>> distro = distros['entries'][3] |
|
92 |
>>> debian = webservice.get(distro['self_link']).jsonBody() |
|
93 |
||
94 |
>>> milestone_3_1 = webservice.named_get( |
|
95 |
... debian['self_link'], "getMilestone", name="3.1").jsonBody() |
|
96 |
>>> print milestone_3_1['self_link'] |
|
97 |
http://.../debian/+milestone/3.1 |
|
98 |
||
8357.2.5
by Curtis Hovey
Added addtional tests to verify that None is returned for a bad milestone lookup. |
99 |
>>> print webservice.named_get( |
100 |
... debian['self_link'], "getMilestone", name="fnord").jsonBody() |
|
101 |
None |
|
102 |
||
7368.5.1
by Gavin Panella
Tests for distro.getSourcePackage API stuff. |
103 |
"getSourcePackage" returns a distribution source package for the given |
104 |
name. |
|
105 |
||
106 |
>>> alsa_utils = webservice.named_get( |
|
107 |
... ubuntu['self_link'], 'getSourcePackage', |
|
108 |
... name='alsa-utils').jsonBody() |
|
7368.5.10
by Gavin Panella
Move the detailed stuff about distribution source packages into a new file. |
109 |
>>> print alsa_utils['self_link'] |
110 |
http://.../ubuntu/+source/alsa-utils |
|
8089.5.1
by Celso Providelo
Fixing bug #349189 (exporting IDistribution.searchSourcePackage API). |
111 |
|
112 |
"searchSourcePackages" returns a collection of distribution source |
|
113 |
packages matching (substring) the given text. |
|
114 |
||
115 |
>>> alsa_results = webservice.named_get( |
|
116 |
... ubuntu['self_link'], 'searchSourcePackages', |
|
117 |
... source_match='a').jsonBody() |
|
118 |
||
119 |
>>> for entry in alsa_results['entries']: |
|
120 |
... print entry['self_link'] |
|
11822.3.1
by Edwin Grubbs
Fix timeout searching for DistributionSourcePackages suggestions for a project. |
121 |
http://.../ubuntu/+source/alsa-utils |
122 |
http://.../ubuntu/+source/commercialpackage |
|
123 |
http://.../ubuntu/+source/foobar |
|
8089.5.1
by Celso Providelo
Fixing bug #349189 (exporting IDistribution.searchSourcePackage API). |
124 |
http://.../ubuntu/+source/mozilla-firefox |
125 |
http://.../ubuntu/+source/netapplet |
|
10236.2.10
by Jonathan Davies
Wrote test for getMirrorByName() API call in Distribution. |
126 |
|
10861.2.1
by William Grant
Move traverse_distro_archive to Distribution.getArchive, and export it. |
127 |
"getArchive" returns a distribution archive (not a PPA) with the given name. |
128 |
||
129 |
>>> partner = webservice.named_get( |
|
130 |
... ubuntu['self_link'], 'getArchive', |
|
131 |
... name='partner').jsonBody() |
|
132 |
>>> print partner['self_link'] |
|
133 |
http://.../ubuntu/+archive/partner |
|
134 |
||
10236.2.10
by Jonathan Davies
Wrote test for getMirrorByName() API call in Distribution. |
135 |
"getMirrorByName" returns a mirror by its unique name. |
136 |
||
137 |
>>> canonical_releases = webservice.named_get( |
|
138 |
... ubuntu['self_link'], 'getMirrorByName', |
|
139 |
... name='canonical-releases').jsonBody() |
|
140 |
>>> pprint_entry(canonical_releases) |
|
141 |
content: u'CD Image' |
|
7675.612.4
by Jonathan Davies
Added newly exposed country_dns_mirror to API tests. |
142 |
country_dns_mirror: False |
10348.3.17
by Jonathan Davies
Fixed mirror test in xx-distribution.txt to have our new country_link field. |
143 |
country_link: u'http://.../+countries/GB' |
10236.2.13
by Jonathan Davies
Added date_created for this mirror output here. |
144 |
date_created: u'2006-10-16T18:31:43.434567+00:00' |
10270.2.22
by Jonathan Davies
Corrected xx-distribution.txt so that its mirror entry has our new fields and |
145 |
date_reviewed: None |
10236.2.10
by Jonathan Davies
Wrote test for getMirrorByName() API call in Distribution. |
146 |
description: None |
147 |
displayname: None |
|
148 |
distribution_link: u'http://.../ubuntu' |
|
149 |
enabled: True |
|
150 |
ftp_base_url: None |
|
151 |
http_base_url: u'http://releases.ubuntu.com/' |
|
152 |
name: u'canonical-releases' |
|
153 |
official_candidate: True |
|
154 |
owner_link: u'http://.../~mark' |
|
10270.2.23
by Jonathan Davies
Aalphabetized JSON output in test. |
155 |
resource_type_link: u'http://.../#distribution_mirror' |
10270.2.22
by Jonathan Davies
Corrected xx-distribution.txt so that its mirror entry has our new fields and |
156 |
reviewer_link: None |
10236.2.10
by Jonathan Davies
Wrote test for getMirrorByName() API call in Distribution. |
157 |
rsync_base_url: None |
158 |
self_link: u'http://.../ubuntu/+mirror/canonical-releases' |
|
159 |
speed: u'100 Mbps' |
|
160 |
status: u'Official' |
|
12243.5.6
by Leonard Richardson
Got another batch of tests to pass. |
161 |
web_link: u'http://launchpad.../ubuntu/+mirror/canonical-releases' |
10270.2.22
by Jonathan Davies
Corrected xx-distribution.txt so that its mirror entry has our new fields and |
162 |
whiteboard: None |
7675.612.6
by Jonathan Davies
Added test of getCountryMirrorForCountry() for checking None values. |
163 |
|
7675.612.43
by Jonathan Davies
Renamed getCountryMirrorForCountry to simply getCountryMirror(). |
164 |
"getCountryMirror" returns the country DNS mirror for a given country; |
165 |
returning None if there isn't one. |
|
7675.612.6
by Jonathan Davies
Added test of getCountryMirrorForCountry() for checking None values. |
166 |
|
7675.612.41
by Jonathan Davies
Do what's necessary to make all tests work. |
167 |
>>> # Prepare stuff. |
168 |
>>> from zope.component import getUtility |
|
14578.4.1
by William Grant
Move the remains of canonical.launchpad.testing to lp.testing. |
169 |
>>> from lp.testing.pages import webservice_for_person |
7675.612.61
by Jonathan Davies
webservice/xx-distribution.txt: Prettify tests. |
170 |
>>> from canonical.launchpad.webapp.interfaces import OAuthPermission |
11716.1.12
by Curtis Hovey
Sorted imports in doctests. |
171 |
>>> from lp.registry.interfaces.distribution import IDistributionSet |
7675.612.61
by Jonathan Davies
webservice/xx-distribution.txt: Prettify tests. |
172 |
>>> from lp.registry.interfaces.person import IPersonSet |
173 |
>>> from simplejson import dumps |
|
174 |
||
7675.612.41
by Jonathan Davies
Do what's necessary to make all tests work. |
175 |
>>> login('admin@canonical.com') |
176 |
>>> ubuntu_distro = getUtility(IDistributionSet).getByName('ubuntu') |
|
7675.612.63
by Jonathan Davies
To defer from the mirror in the doctests, use Showa as an example. |
177 |
>>> showa_station = factory.makeMirror(ubuntu_distro, |
178 |
... "Showa Station", country=9, |
|
179 |
... http_url="http://mirror.showa.antarctica.org/ubuntu", |
|
7675.612.61
by Jonathan Davies
webservice/xx-distribution.txt: Prettify tests. |
180 |
... official_candidate=True) |
7675.612.63
by Jonathan Davies
To defer from the mirror in the doctests, use Showa as an example. |
181 |
>>> showa_station_log = factory.makeMirrorProbeRecord(showa_station) |
7675.612.41
by Jonathan Davies
Do what's necessary to make all tests work. |
182 |
|
183 |
>>> login(ANONYMOUS) |
|
184 |
>>> karl_db = getUtility(IPersonSet).getByName('karl') |
|
185 |
>>> karl_webservice = webservice_for_person(karl_db, |
|
186 |
... permission=OAuthPermission.WRITE_PUBLIC) |
|
187 |
>>> logout() |
|
188 |
||
7675.612.61
by Jonathan Davies
webservice/xx-distribution.txt: Prettify tests. |
189 |
>>> # Mark new mirror as official and a country mirror. |
190 |
>>> patch = { |
|
191 |
... u'status': 'Official', |
|
7675.612.41
by Jonathan Davies
Do what's necessary to make all tests work. |
192 |
... u'country_dns_mirror': True |
193 |
... } |
|
7675.612.61
by Jonathan Davies
webservice/xx-distribution.txt: Prettify tests. |
194 |
|
7675.612.41
by Jonathan Davies
Do what's necessary to make all tests work. |
195 |
>>> antarctica_patch_target = webservice.named_get( |
196 |
... ubuntu['self_link'], 'getMirrorByName', |
|
7675.612.63
by Jonathan Davies
To defer from the mirror in the doctests, use Showa as an example. |
197 |
... name='mirror.showa.antarctica.org-archive').jsonBody() |
7675.612.61
by Jonathan Davies
webservice/xx-distribution.txt: Prettify tests. |
198 |
|
199 |
>>> response = karl_webservice.patch( |
|
200 |
... antarctica_patch_target['self_link'], 'application/json', |
|
201 |
... dumps(patch)) |
|
7675.612.41
by Jonathan Davies
Do what's necessary to make all tests work. |
202 |
|
7675.612.6
by Jonathan Davies
Added test of getCountryMirrorForCountry() for checking None values. |
203 |
>>> antarctica = webservice.get("/+countries/AQ").jsonBody() |
7675.612.8
by Jonathan Davies
Added more tests for getCountryMirrorForCountry(); ensuring mirror_type values |
204 |
>>> antarctica_country_mirror_archive = webservice.named_get( |
7675.612.43
by Jonathan Davies
Renamed getCountryMirrorForCountry to simply getCountryMirror(). |
205 |
... ubuntu['self_link'], 'getCountryMirror', |
7675.612.44
by Jonathan Davies
Removed whitespace from things. |
206 |
... country=antarctica['self_link'], |
207 |
... mirror_type="Archive").jsonBody() |
|
7675.612.8
by Jonathan Davies
Added more tests for getCountryMirrorForCountry(); ensuring mirror_type values |
208 |
>>> pprint_entry(antarctica_country_mirror_archive) |
209 |
content: u'Archive' |
|
210 |
country_dns_mirror: True |
|
211 |
country_link: u'http://.../+countries/AQ' |
|
7675.612.61
by Jonathan Davies
webservice/xx-distribution.txt: Prettify tests. |
212 |
... |
7675.612.8
by Jonathan Davies
Added more tests for getCountryMirrorForCountry(); ensuring mirror_type values |
213 |
|
214 |
>>> uk = webservice.get("/+countries/GB").jsonBody() |
|
215 |
>>> uk_country_mirror_archive = webservice.named_get( |
|
7675.612.43
by Jonathan Davies
Renamed getCountryMirrorForCountry to simply getCountryMirror(). |
216 |
... ubuntu['self_link'], 'getCountryMirror', |
7675.612.44
by Jonathan Davies
Removed whitespace from things. |
217 |
... country=uk['self_link'], |
218 |
... mirror_type="Archive") |
|
7675.612.8
by Jonathan Davies
Added more tests for getCountryMirrorForCountry(); ensuring mirror_type values |
219 |
>>> print uk_country_mirror_archive.jsonBody() |
7675.612.6
by Jonathan Davies
Added test of getCountryMirrorForCountry() for checking None values. |
220 |
None |
7675.612.8
by Jonathan Davies
Added more tests for getCountryMirrorForCountry(); ensuring mirror_type values |
221 |
|
7675.612.43
by Jonathan Davies
Renamed getCountryMirrorForCountry to simply getCountryMirror(). |
222 |
For "getCountryMirror", the mirror_type parameter must be "Archive" or |
7675.612.8
by Jonathan Davies
Added more tests for getCountryMirrorForCountry(); ensuring mirror_type values |
223 |
"CD Images": |
224 |
||
225 |
>>> uk_country_mirror_archive = webservice.named_get( |
|
7675.612.43
by Jonathan Davies
Renamed getCountryMirrorForCountry to simply getCountryMirror(). |
226 |
... ubuntu['self_link'], 'getCountryMirror', |
7675.612.44
by Jonathan Davies
Removed whitespace from things. |
227 |
... country=uk['self_link'], |
228 |
... mirror_type="Bogus") |
|
7675.612.8
by Jonathan Davies
Added more tests for getCountryMirrorForCountry(); ensuring mirror_type values |
229 |
>>> print uk_country_mirror_archive.jsonBody() |
230 |
Traceback (most recent call last): |
|
231 |
... |
|
7675.612.67
by Jonathan Davies
Various grammar and word-wrapping fixes. |
232 |
ValueError: mirror_type: Invalid value "Bogus". Acceptable values are: |
233 |
Archive, CD Image |