/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
6015.10.1 by John Arbash Meinel
Merge the package-freshness check from bzr-2.5 to the 2.4 series. bug #609187
1
# Copyright (C) 2011 Canonical Ltd
2
#
3
# This program is free software; you can redistribute it and/or modify
4
# it under the terms of the GNU General Public License as published by
5
# the Free Software Foundation; either version 2 of the License, or
6
# (at your option) any later version.
7
#
8
# This program is distributed in the hope that it will be useful,
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11
# GNU General Public License for more details.
12
#
13
# You should have received a copy of the GNU General Public License
14
# along with this program; if not, write to the Free Software
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
17
"""Tools for dealing with the Launchpad API without using launchpadlib.
18
"""
19
20
import doctest
21
import socket
22
23
from bzrlib import tests
24
from bzrlib.plugins import launchpad
25
from bzrlib.plugins.launchpad import lp_api_lite
26
27
from testtools.matchers import DocTestMatches
28
29
30
class _JSONParserFeature(tests.Feature):
31
32
    def _probe(self):
33
        return lp_api_lite.json is not None
34
35
    def feature_name(self):
36
        return 'simplejson or json'
37
38
JSONParserFeature = _JSONParserFeature()
39
40
_example_response = r"""
41
{
42
    "total_size": 2,
43
    "start": 0,
44
    "next_collection_link": "https://api.launchpad.net/1.0/ubuntu/+archive/primary?distro_series=%2Fubuntu%2Flucid&exact_match=true&source_name=%22bzr%22&status=Published&ws.op=getPublishedSources&ws.start=1&ws.size=1",
45
    "entries": [
46
        {
47
            "package_creator_link": "https://api.launchpad.net/1.0/~maxb",
48
            "package_signer_link": "https://api.launchpad.net/1.0/~jelmer",
49
            "source_package_name": "bzr",
50
            "removal_comment": null,
51
            "display_name": "bzr 2.1.4-0ubuntu1 in lucid",
52
            "date_made_pending": null,
53
            "source_package_version": "2.1.4-0ubuntu1",
54
            "date_superseded": null,
55
            "http_etag": "\"9ba966152dec474dc0fe1629d0bbce2452efaf3b-5f4c3fbb3eaf26d502db4089777a9b6a0537ffab\"",
56
            "self_link": "https://api.launchpad.net/1.0/ubuntu/+archive/primary/+sourcepub/1750327",
57
            "distro_series_link": "https://api.launchpad.net/1.0/ubuntu/lucid",
58
            "component_name": "main",
59
            "status": "Published",
60
            "date_removed": null,
61
            "pocket": "Updates",
62
            "date_published": "2011-05-30T06:09:58.653984+00:00",
63
            "removed_by_link": null,
64
            "section_name": "devel",
65
            "resource_type_link": "https://api.launchpad.net/1.0/#source_package_publishing_history",
66
            "archive_link": "https://api.launchpad.net/1.0/ubuntu/+archive/primary",
67
            "package_maintainer_link": "https://api.launchpad.net/1.0/~ubuntu-devel-discuss-lists",
68
            "date_created": "2011-05-30T05:19:12.233621+00:00",
69
            "scheduled_deletion_date": null
70
        }
71
    ]
72
}"""
73
74
_no_versions_response = '{"total_size": 0, "start": 0, "entries": []}'
75
76
77
class TestLatestPublication(tests.TestCase):
78
79
    def make_latest_publication(self, archive='ubuntu', series='natty',
80
                                project='bzr'):
81
        return lp_api_lite.LatestPublication(archive, series, project)
82
83
    def assertPlace(self, place, archive, series, project):
84
        lp = lp_api_lite.LatestPublication(archive, series, project)
85
        self.assertEqual(place, lp.place())
86
87
    def test_init(self):
88
        latest_pub = self.make_latest_publication()
89
        self.assertEqual('ubuntu', latest_pub._archive)
90
        self.assertEqual('natty', latest_pub._series)
91
        self.assertEqual('bzr', latest_pub._project)
92
        self.assertEqual('Release', latest_pub._pocket)
93
94
    def test__archive_URL(self):
95
        latest_pub = self.make_latest_publication()
96
        self.assertEqual(
97
            'https://api.launchpad.net/1.0/ubuntu/+archive/primary',
98
            latest_pub._archive_URL())
99
100
    def test__publication_status_for_ubuntu(self):
101
        latest_pub = self.make_latest_publication()
102
        self.assertEqual('Published', latest_pub._publication_status())
103
104
    def test__publication_status_for_debian(self):
105
        latest_pub = self.make_latest_publication(archive='debian')
106
        self.assertEqual('Pending', latest_pub._publication_status())
107
108
    def test_pocket(self):
109
        latest_pub = self.make_latest_publication(series='natty-proposed')
110
        self.assertEqual('natty', latest_pub._series)
111
        self.assertEqual('Proposed', latest_pub._pocket)
112
113
    def test_series_None(self):
114
        latest_pub = self.make_latest_publication(series=None)
115
        self.assertEqual('ubuntu', latest_pub._archive)
116
        self.assertEqual(None, latest_pub._series)
117
        self.assertEqual('bzr', latest_pub._project)
118
        self.assertEqual('Release', latest_pub._pocket)
119
120
    def test__query_params(self):
121
        latest_pub = self.make_latest_publication()
122
        self.assertEqual({'ws.op': 'getPublishedSources',
123
                          'exact_match': 'true',
124
                          'source_name': '"bzr"',
125
                          'status': 'Published',
126
                          'ws.size': '1',
127
                          'distro_series': '/ubuntu/natty',
128
                          'pocket': 'Release',
129
                         }, latest_pub._query_params())
130
131
    def test__query_params_no_series(self):
132
        latest_pub = self.make_latest_publication(series=None)
133
        self.assertEqual({'ws.op': 'getPublishedSources',
134
                          'exact_match': 'true',
135
                          'source_name': '"bzr"',
136
                          'status': 'Published',
137
                          'ws.size': '1',
138
                          'pocket': 'Release',
139
                         }, latest_pub._query_params())
140
141
    def test__query_params_pocket(self):
142
        latest_pub = self.make_latest_publication(series='natty-proposed')
143
        self.assertEqual({'ws.op': 'getPublishedSources',
144
                          'exact_match': 'true',
145
                          'source_name': '"bzr"',
146
                          'status': 'Published',
147
                          'ws.size': '1',
148
                          'distro_series': '/ubuntu/natty',
149
                          'pocket': 'Proposed',
150
                         }, latest_pub._query_params())
151
152
    def test__query_URL(self):
153
        latest_pub = self.make_latest_publication()
154
        # we explicitly sort params, so we can be sure this URL matches exactly
155
        self.assertEqual(
156
            'https://api.launchpad.net/1.0/ubuntu/+archive/primary'
157
            '?distro_series=%2Fubuntu%2Fnatty&exact_match=true'
158
            '&pocket=Release&source_name=%22bzr%22&status=Published'
159
            '&ws.op=getPublishedSources&ws.size=1',
160
            latest_pub._query_URL())
161
162
    def DONT_test__gracefully_handle_failed_rpc_connection(self):
163
        # TODO: This test kind of sucks. We intentionally create an arbitrary
164
        #       port and don't listen to it, because we want the request to fail.
165
        #       However, it seems to take 1s for it to timeout. Is there a way
166
        #       to make it fail faster?
167
        latest_pub = self.make_latest_publication()
168
        s = socket.socket()
169
        s.bind(('127.0.0.1', 0))
170
        addr, port = s.getsockname()
171
        latest_pub.LP_API_ROOT = 'http://%s:%s/' % (addr, port)
172
        s.close()
173
        self.assertIs(None, latest_pub._get_lp_info())
174
175
    def DONT_test__query_launchpad(self):
176
        # TODO: This is a test that we are making a valid request against
177
        #       launchpad. This seems important, but it is slow, requires net
178
        #       access, and requires launchpad to be up and running. So for
179
        #       now, it is commented out for production tests.
180
        latest_pub = self.make_latest_publication()
181
        json_txt = latest_pub._get_lp_info()
182
        self.assertIsNot(None, json_txt)
183
        if lp_api_lite.json is None:
184
            # We don't have a way to parse the text
185
            return
186
        # The content should be a valid json result
187
        content = lp_api_lite.json.loads(json_txt)
188
        entries = content['entries'] # It should have an 'entries' field.
189
        # ws.size should mean we get 0 or 1, and there should be something
190
        self.assertEqual(1, len(entries))
191
        entry = entries[0]
192
        self.assertEqual('bzr', entry['source_package_name'])
193
        version = entry['source_package_version']
194
        self.assertIsNot(None, version)
195
196
    def test__get_lp_info_no_json(self):
197
        # If we can't parse the json, we don't make the query.
198
        self.overrideAttr(lp_api_lite, 'json', None)
199
        latest_pub = self.make_latest_publication()
200
        self.assertIs(None, latest_pub._get_lp_info())
201
202
    def test__parse_json_info_no_module(self):
203
        # If a json parsing module isn't available, we just return None here.
204
        self.overrideAttr(lp_api_lite, 'json', None)
205
        latest_pub = self.make_latest_publication()
206
        self.assertIs(None, latest_pub._parse_json_info(_example_response))
207
208
    def test__parse_json_example_response(self):
209
        self.requireFeature(JSONParserFeature)
210
        latest_pub = self.make_latest_publication()
211
        content = latest_pub._parse_json_info(_example_response)
212
        self.assertIsNot(None, content)
213
        self.assertEqual(2, content['total_size'])
214
        entries = content['entries']
215
        self.assertEqual(1, len(entries))
216
        entry = entries[0]
217
        self.assertEqual('bzr', entry['source_package_name'])
218
        self.assertEqual("2.1.4-0ubuntu1", entry["source_package_version"])
219
220
    def test__parse_json_not_json(self):
221
        self.requireFeature(JSONParserFeature)
222
        latest_pub = self.make_latest_publication()
223
        self.assertIs(None, latest_pub._parse_json_info('Not_valid_json'))
224
225
    def test_get_latest_version_no_response(self):
226
        latest_pub = self.make_latest_publication()
227
        latest_pub._get_lp_info = lambda: None
228
        self.assertEqual(None, latest_pub.get_latest_version())
229
230
    def test_get_latest_version_no_json(self):
231
        self.overrideAttr(lp_api_lite, 'json', None)
232
        latest_pub = self.make_latest_publication()
233
        self.assertEqual(None, latest_pub.get_latest_version())
234
235
    def test_get_latest_version_invalid_json(self):
236
        self.requireFeature(JSONParserFeature)
237
        latest_pub = self.make_latest_publication()
238
        latest_pub._get_lp_info = lambda: "not json"
239
        self.assertEqual(None, latest_pub.get_latest_version())
240
241
    def test_get_latest_version_no_versions(self):
242
        self.requireFeature(JSONParserFeature)
243
        latest_pub = self.make_latest_publication()
244
        latest_pub._get_lp_info = lambda: _no_versions_response
245
        self.assertEqual(None, latest_pub.get_latest_version())
246
247
    def test_get_latest_version_missing_entries(self):
248
        # Launchpad's no-entries response does have an empty entries value.
249
        # However, lets test that we handle other failures without tracebacks
250
        self.requireFeature(JSONParserFeature)
251
        latest_pub = self.make_latest_publication()
252
        latest_pub._get_lp_info = lambda: '{}'
253
        self.assertEqual(None, latest_pub.get_latest_version())
254
255
    def test_get_latest_version_invalid_entries(self):
256
        # Make sure we sanely handle a json response we don't understand
257
        self.requireFeature(JSONParserFeature)
258
        latest_pub = self.make_latest_publication()
259
        latest_pub._get_lp_info = lambda: '{"entries": {"a": 1}}'
260
        self.assertEqual(None, latest_pub.get_latest_version())
261
262
    def test_get_latest_version_example(self):
263
        self.requireFeature(JSONParserFeature)
264
        latest_pub = self.make_latest_publication()
265
        latest_pub._get_lp_info = lambda: _example_response
266
        self.assertEqual("2.1.4-0ubuntu1", latest_pub.get_latest_version())
267
268
    def DONT_test_get_latest_version_from_launchpad(self):
269
        self.requireFeature(JSONParserFeature)
270
        latest_pub = self.make_latest_publication()
271
        self.assertIsNot(None, latest_pub.get_latest_version())
272
273
    def test_place(self):
274
        self.assertPlace('Ubuntu', 'ubuntu', None, 'bzr')
275
        self.assertPlace('Ubuntu Natty', 'ubuntu', 'natty', 'bzr')
276
        self.assertPlace('Ubuntu Natty Proposed', 'ubuntu', 'natty-proposed',
277
                         'bzr')
278
        self.assertPlace('Debian', 'debian', None, 'bzr')
279
        self.assertPlace('Debian Sid', 'debian', 'sid', 'bzr')
280
281
282
class TestIsUpToDate(tests.TestCase):
283
284
    def assertPackageBranchRe(self, url, user, archive, series, project):
285
        m = launchpad._package_branch.search(url)
286
        if m is None:
287
            self.fail('package_branch regex did not match url: %s' % (url,))
288
        self.assertEqual(
289
            (user, archive, series, project),
290
            m.group('user', 'archive', 'series', 'project'))
291
292
    def assertNotPackageBranch(self, url):
293
        self.assertIs(None, launchpad._get_package_branch_info(url))
294
295
    def assertBranchInfo(self, url, archive, series, project):
296
        self.assertEqual((archive, series, project),
297
            launchpad._get_package_branch_info(url))
298
299
    def test_package_branch_regex(self):
300
        self.assertPackageBranchRe(
301
            'http://bazaar.launchpad.net/+branch/ubuntu/foo',
302
            None, 'ubuntu', None, 'foo')
303
        self.assertPackageBranchRe(
304
            'bzr+ssh://bazaar.launchpad.net/+branch/ubuntu/natty/foo',
305
            None, 'ubuntu', 'natty/', 'foo')
306
        self.assertPackageBranchRe(
307
            'sftp://bazaar.launchpad.net/+branch/debian/foo',
308
            None, 'debian', None, 'foo')
309
        self.assertPackageBranchRe(
310
            'http://bazaar.launchpad.net/+branch/debian/sid/foo',
311
            None, 'debian', 'sid/', 'foo')
312
        self.assertPackageBranchRe(
313
            'http://bazaar.launchpad.net/+branch'
314
            '/~ubuntu-branches/ubuntu/natty/foo/natty',
315
            '~ubuntu-branches/', 'ubuntu', 'natty/', 'foo')
316
        self.assertPackageBranchRe(
317
            'http://bazaar.launchpad.net/+branch'
318
            '/~user/ubuntu/natty/foo/test',
319
            '~user/', 'ubuntu', 'natty/', 'foo')
320
321
    def test_package_branch_doesnt_match(self):
322
        self.assertNotPackageBranch('http://example.com/ubuntu/foo')
323
        self.assertNotPackageBranch(
324
            'http://bazaar.launchpad.net/+branch/bzr')
325
        self.assertNotPackageBranch(
326
            'http://bazaar.launchpad.net/+branch/~bzr-pqm/bzr/bzr.dev')
327
        # Not a packaging branch because ~user isn't ~ubuntu-branches
328
        self.assertNotPackageBranch(
329
            'http://bazaar.launchpad.net/+branch'
330
            '/~user/ubuntu/natty/foo/natty')
6015.10.3 by John Arbash Meinel
Add a test for the new behavior.
331
        # Older versions of bzr-svn/hg/git did not set Branch.base until after
332
        # they called Branch.__init__().
333
        self.assertNotPackageBranch(None)
6015.10.1 by John Arbash Meinel
Merge the package-freshness check from bzr-2.5 to the 2.4 series. bug #609187
334
335
    def test__get_package_branch_info(self):
336
        self.assertBranchInfo(
337
            'bzr+ssh://bazaar.launchpad.net/+branch/ubuntu/natty/foo',
338
            'ubuntu', 'natty', 'foo')
339
        self.assertBranchInfo(
340
            'bzr+ssh://bazaar.launchpad.net/+branch'
341
            '/~ubuntu-branches/ubuntu/natty/foo/natty',
342
            'ubuntu', 'natty', 'foo')
343
        self.assertBranchInfo(
344
            'http://bazaar.launchpad.net/+branch'
345
            '/~ubuntu-branches/debian/sid/foo/sid',
346
            'debian', 'sid', 'foo')
347
348
349
class TestGetMostRecentTag(tests.TestCaseWithMemoryTransport):
350
351
    def make_simple_builder(self):
352
        builder = self.make_branch_builder('tip')
353
        builder.build_snapshot('A', [], [
354
            ('add', ('', 'root-id', 'directory', None))])
355
        b = builder.get_branch()
356
        b.tags.set_tag('tip-1.0', 'A')
357
        return builder, b, b.tags.get_tag_dict()
358
359
    def test_get_most_recent_tag_tip(self):
360
        builder, b, tag_dict = self.make_simple_builder()
361
        self.assertEqual('tip-1.0',
362
                         lp_api_lite.get_most_recent_tag(tag_dict, b))
363
364
    def test_get_most_recent_tag_older(self):
365
        builder, b, tag_dict = self.make_simple_builder()
366
        builder.build_snapshot('B', ['A'], [])
367
        self.assertEqual('B', b.last_revision())
368
        self.assertEqual('tip-1.0',
369
                         lp_api_lite.get_most_recent_tag(tag_dict, b))
370
371
372
class StubLatestPublication(object):
373
374
    def __init__(self, latest):
375
        self.called = False
376
        self.latest = latest
377
378
    def get_latest_version(self):
379
        self.called = True
380
        return self.latest
381
382
    def place(self):
383
        return 'Ubuntu Natty'
384
385
386
class TestReportFreshness(tests.TestCaseWithMemoryTransport):
387
388
    def setUp(self):
389
        super(TestReportFreshness, self).setUp()
390
        builder = self.make_branch_builder('tip')
391
        builder.build_snapshot('A', [], [
392
            ('add', ('', 'root-id', 'directory', None))])
393
        self.branch = builder.get_branch()
394
395
    def assertFreshnessReports(self, verbosity, latest_version, content):
396
        """Assert that lp_api_lite.report_freshness reports the given content.
397
398
        :param verbosity: The reporting level
399
        :param latest_version: The version reported by StubLatestPublication
400
        :param content: The expected content. This should be in DocTest form.
401
        """
402
        orig_log_len = len(self.get_log())
403
        lp_api_lite.report_freshness(self.branch, verbosity,
404
            StubLatestPublication(latest_version))
405
        new_content = self.get_log()[orig_log_len:]
406
        # Strip out lines that have LatestPublication.get_* because those are
407
        # timing related lines. While interesting to log for now, they aren't
408
        # something we want to be testing
409
        new_content = new_content.split('\n')
410
        for i in range(2):
411
            if (len(new_content) > 0
412
                and 'LatestPublication.get_' in new_content[0]):
413
                new_content = new_content[1:]
414
        new_content = '\n'.join(new_content)
415
        self.assertThat(new_content,
416
            DocTestMatches(content,
417
                doctest.ELLIPSIS | doctest.REPORT_UDIFF))
418
419
    def test_verbosity_off_skips_check(self):
420
        # We force _get_package_branch_info so that we know it would otherwise
421
        # try to connect to launcphad
422
        self.overrideAttr(launchpad, '_get_package_branch_info',
423
            lambda x: ('ubuntu', 'natty', 'bzr'))
424
        self.overrideAttr(lp_api_lite, 'LatestPublication',
425
            lambda *args: self.fail('Tried to query launchpad'))
426
        c = self.branch.get_config()
427
        c.set_user_option('launchpad.packaging_verbosity', 'off')
428
        orig_log_len = len(self.get_log())
429
        launchpad._check_is_up_to_date(self.branch)
430
        new_content = self.get_log()[orig_log_len:]
431
        self.assertContainsRe(new_content,
432
            'not checking memory.*/tip/ because verbosity is turned off')
433
434
    def test_verbosity_off(self):
435
        latest_pub = StubLatestPublication('1.0-1ubuntu2')
436
        lp_api_lite.report_freshness(self.branch, 'off', latest_pub)
437
        self.assertFalse(latest_pub.called)
438
439
    def test_verbosity_all_out_of_date_smoke(self):
440
        self.branch.tags.set_tag('1.0-1ubuntu1', 'A')
441
        self.assertFreshnessReports('all', '1.0-1ubuntu2',
442
             '    INFO  Most recent Ubuntu Natty version: 1.0-1ubuntu2\n'
443
             'Packaging branch version: 1.0-1ubuntu1\n'
444
             'Packaging branch status: OUT-OF-DATE\n')
445
446
447
class Test_GetNewestVersions(tests.TestCaseWithMemoryTransport):
448
449
    def setUp(self):
450
        super(Test_GetNewestVersions, self).setUp()
451
        builder = self.make_branch_builder('tip')
452
        builder.build_snapshot('A', [], [
453
            ('add', ('', 'root-id', 'directory', None))])
454
        self.branch = builder.get_branch()
455
456
    def assertLatestVersions(self, latest_branch_version, pub_version):
457
        if latest_branch_version is not None:
458
            self.branch.tags.set_tag(latest_branch_version, 'A')
459
        latest_pub = StubLatestPublication(pub_version)
460
        self.assertEqual((pub_version, latest_branch_version),
461
            lp_api_lite._get_newest_versions(self.branch, latest_pub))
462
463
    def test_no_tags(self):
464
        self.assertLatestVersions(None, '1.0-1ubuntu2')
465
466
    def test_out_of_date(self):
467
        self.assertLatestVersions('1.0-1ubuntu1', '1.0-1ubuntu2')
468
469
    def test_up_to_date(self):
470
        self.assertLatestVersions('1.0-1ubuntu2', '1.0-1ubuntu2')
471
472
    def test_missing(self):
473
        self.assertLatestVersions(None, None)
474
475
476
class Test_ReportFreshness(tests.TestCase):
477
478
    def assertReportedFreshness(self, verbosity, latest_ver, branch_latest_ver,
479
                               content, place='Ubuntu Natty'):
480
        """Assert that lp_api_lite.report_freshness reports the given content.
481
        """
482
        reported = []
483
        def report_func(value):
484
            reported.append(value)
485
        lp_api_lite._report_freshness(latest_ver, branch_latest_ver, place,
486
                                      verbosity, report_func)
487
        new_content = '\n'.join(reported)
488
        self.assertThat(new_content,
489
            DocTestMatches(content,
490
                doctest.ELLIPSIS | doctest.REPORT_UDIFF))
491
492
    def test_verbosity_minimal_no_tags(self):
493
        self.assertReportedFreshness('minimal', '1.0-1ubuntu2', None,
494
            'Branch is OUT-OF-DATE, Ubuntu Natty has 1.0-1ubuntu2\n')
495
496
    def test_verbosity_minimal_out_of_date(self):
497
        self.assertReportedFreshness('minimal', '1.0-1ubuntu2', '1.0-1ubuntu1',
498
            '1.0-1ubuntu1 is OUT-OF-DATE,'
499
            ' Ubuntu Natty has 1.0-1ubuntu2\n')
500
501
    def test_verbosity_minimal_up_to_date(self):
502
        self.assertReportedFreshness('minimal', '1.0-1ubuntu2', '1.0-1ubuntu2',
503
             '')
504
505
    def test_verbosity_minimal_missing(self):
506
        self.assertReportedFreshness('minimal', None, None,
507
             '')
508
509
    def test_verbosity_short_out_of_date(self):
510
        self.assertReportedFreshness('short', '1.0-1ubuntu2', '1.0-1ubuntu1',
511
            '1.0-1ubuntu1 is OUT-OF-DATE,'
512
            ' Ubuntu Natty has 1.0-1ubuntu2\n')
513
514
    def test_verbosity_short_up_to_date(self):
515
        self.assertReportedFreshness('short', '1.0-1ubuntu2', '1.0-1ubuntu2',
516
             '1.0-1ubuntu2 is CURRENT in Ubuntu Natty')
517
518
    def test_verbosity_short_missing(self):
519
        self.assertReportedFreshness('short', None, None,
520
             'Ubuntu Natty is MISSING a version')
521
522
    def test_verbosity_all_no_tags(self):
523
        self.assertReportedFreshness('all', '1.0-1ubuntu2', None,
524
             'Most recent Ubuntu Natty version: 1.0-1ubuntu2\n'
525
             'Packaging branch version: None\n'
526
             'Packaging branch status: OUT-OF-DATE\n')
527
528
    def test_verbosity_all_out_of_date(self):
529
        self.assertReportedFreshness('all', '1.0-1ubuntu2', '1.0-1ubuntu1',
530
             'Most recent Ubuntu Natty version: 1.0-1ubuntu2\n'
531
             'Packaging branch version: 1.0-1ubuntu1\n'
532
             'Packaging branch status: OUT-OF-DATE\n')
533
534
    def test_verbosity_all_up_to_date(self):
535
        self.assertReportedFreshness('all', '1.0-1ubuntu2', '1.0-1ubuntu2',
536
             'Most recent Ubuntu Natty version: 1.0-1ubuntu2\n'
537
             'Packaging branch status: CURRENT\n')
538
539
    def test_verbosity_all_missing(self):
540
        self.assertReportedFreshness('all', None, None,
541
             'Most recent Ubuntu Natty version: MISSING\n')
542
543
    def test_verbosity_None_is_all(self):
544
        self.assertReportedFreshness(None, '1.0-1ubuntu2', '1.0-1ubuntu2',
545
             'Most recent Ubuntu Natty version: 1.0-1ubuntu2\n'
546
             'Packaging branch status: CURRENT\n')