/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/plugins/launchpad/test_lp_api_lite.py

  • Committer: Vincent Ladeuil
  • Date: 2011-11-24 15:48:29 UTC
  • mfrom: (6289 +trunk)
  • mto: This revision was merged to the branch mainline in revision 6337.
  • Revision ID: v.ladeuil+lp@free.fr-20111124154829-avowjpsxdl8yp2vz
merge trunk resolving conflicts

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
import socket
22
22
 
23
23
from bzrlib import tests
 
24
from bzrlib.tests import features
24
25
from bzrlib.plugins import launchpad
25
26
from bzrlib.plugins.launchpad import lp_api_lite
26
 
 
27
27
from testtools.matchers import DocTestMatches
28
28
 
29
29
 
30
 
class _JSONParserFeature(tests.Feature):
 
30
class _JSONParserFeature(features.Feature):
31
31
 
32
32
    def _probe(self):
33
33
        return lp_api_lite.json is not None
35
35
    def feature_name(self):
36
36
        return 'simplejson or json'
37
37
 
 
38
 
38
39
JSONParserFeature = _JSONParserFeature()
39
40
 
 
41
 
40
42
_example_response = r"""
41
43
{
42
44
    "total_size": 2,
185
187
            return
186
188
        # The content should be a valid json result
187
189
        content = lp_api_lite.json.loads(json_txt)
188
 
        entries = content['entries'] # It should have an 'entries' field.
 
190
        entries = content['entries']  # It should have an 'entries' field.
189
191
        # ws.size should mean we get 0 or 1, and there should be something
190
192
        self.assertEqual(1, len(entries))
191
193
        entry = entries[0]
482
484
        reported = []
483
485
        def report_func(value):
484
486
            reported.append(value)
 
487
 
485
488
        lp_api_lite._report_freshness(latest_ver, branch_latest_ver, place,
486
489
                                      verbosity, report_func)
487
490
        new_content = '\n'.join(reported)