~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/code/xmlrpc/tests/test_codehosting.py

  • Committer: Launchpad Patch Queue Manager
  • Date: 2011-08-15 13:18:37 UTC
  • mfrom: (13662.5.6 push-creates-package)
  • Revision ID: launchpad@pqm.canonical.com-20110815131837-cp2nb9wc52fswn67
[r=adeuring][bug=386596] Push creates source package names.

Show diffs side-by-side

added added

removed removed

Lines of Context:
418
418
        message = "No such distribution series: 'ningnangnong'."
419
419
        self.assertEqual(faults.NotFound(message), fault)
420
420
 
 
421
    def test_createBranch_missing_sourcepackagename(self):
 
422
        # If createBranch is called with the path to a missing source
 
423
        # package, it will create the source package.
 
424
        owner = self.factory.makePerson()
 
425
        distroseries = self.factory.makeDistroSeries()
 
426
        branch_name = self.factory.getUniqueString()
 
427
        unique_name = '/~%s/%s/%s/ningnangnong/%s' % (
 
428
            owner.name, distroseries.distribution.name, distroseries.name,
 
429
            branch_name)
 
430
        branch_id = self.codehosting_api.createBranch(
 
431
            owner.id, escape(unique_name))
 
432
        login(ANONYMOUS)
 
433
        branch = self.branch_lookup.get(branch_id)
 
434
        self.assertEqual(owner, branch.owner)
 
435
        self.assertEqual(distroseries, branch.distroseries)
 
436
        self.assertEqual(
 
437
            'ningnangnong', branch.sourcepackagename.name)
 
438
        self.assertEqual(branch_name, branch.name)
 
439
        self.assertEqual(owner, branch.registrant)
 
440
        self.assertEqual(BranchType.HOSTED, branch.branch_type)
 
441
 
421
442
    def test_createBranch_invalid_sourcepackagename(self):
422
 
        # If createBranch is called with the path to an invalid source
423
 
        # package, it will return a Fault saying so.
 
443
        # If createBranch is called with an invalid path, it will fault.
424
444
        owner = self.factory.makePerson()
425
445
        distroseries = self.factory.makeDistroSeries()
426
446
        branch_name = self.factory.getUniqueString()
427
 
        unique_name = '/~%s/%s/%s/ningnangnong/%s' % (
 
447
        unique_name = '/~%s/%s/%s/ningn%%20angnong/%s' % (
428
448
            owner.name, distroseries.distribution.name, distroseries.name,
429
449
            branch_name)
430
450
        fault = self.codehosting_api.createBranch(
431
451
            owner.id, escape(unique_name))
432
 
        message = "No such source package: 'ningnangnong'."
433
 
        self.assertEqual(faults.NotFound(message), fault)
 
452
        self.assertEqual(
 
453
            faults.InvalidSourcePackageName('ningn%20angnong'), fault)
434
454
 
435
455
    def test_createBranch_using_branch_alias(self):
436
456
        # Branches can be created using the branch alias and the full unique