~mounir-bsaibes/launchpad-work-items-tracker/mb-wgs-changes

« back to all changes in this revision

Viewing changes to lpworkitems/tests/test_models.py

  • Committer: James Westby
  • Date: 2011-12-06 19:51:18 UTC
  • mfrom: (285.1.1 trunk-perf-improvements)
  • Revision ID: james.westby@linaro.org-20111206195118-6a743qs4x1364gyv
Improve the performance of the collector by extracting the names of LP resources from their URL when doing so via Launchpadlib would incur going over the network

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
from lpworkitems.models import (
4
4
    Blueprint,
5
5
    BlueprintGroup,
 
6
    extract_last_path_segment_from_url,
 
7
    extract_user_name_from_url,
6
8
    get_whiteboard_section,
7
9
    )
8
10
from lpworkitems.testing import TestCaseWithFakeLaunchpad
230
232
        lp_bp = self.lp.make_blueprint()
231
233
        bp_group = BlueprintGroup.from_launchpad(lp_bp)
232
234
        self.assertEqual(None, bp_group.area)
 
235
 
 
236
 
 
237
class TestHelpers(TestCase):
 
238
 
 
239
    def test_extract_last_path_segment_from_url(self):
 
240
        url = 'https://api.launchpad.net/devel/foo/+milestone/bar'
 
241
        self.assertEqual(
 
242
            'bar', extract_last_path_segment_from_url(url))
 
243
 
 
244
    def test_extract_user_name_from_url(self):
 
245
        url = 'https://api.launchpad.net/devel/~user'
 
246
        self.assertEqual('user', extract_user_name_from_url(url))