~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/soyuz/tests/test_binarypackagepath.py

  • Committer: Steve Kowalik
  • Date: 2011-06-19 07:26:23 UTC
  • mto: (7675.1045.510 db-devel)
  • mto: This revision was merged to the branch mainline in revision 13402.
  • Revision ID: stevenk@ubuntu.com-20110619072623-e7ls2ma79l8aq309
* BinaryPackagePaths -> BinaryPackagePath.
* Grant SELECT, INSERT, DELETE to launchpad_main.
* Create IBinaryPackagePath and IBinaryPackagePathSource which are implemented
  in BinaryPackagePath, and test same.
* Create IBinaryPackageReleaseContents and IBinaryPackageReleaseContentsSet
  which are implemented in BinaryPackageReleaseContents, and test same.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Copyright 2011 Canonical Ltd.  This software is licensed under the
 
2
# GNU Affero General Public License version 3 (see the file LICENSE).
 
3
 
 
4
"""Test the Binary Package Path model."""
 
5
 
 
6
__metaclass__ = type
 
7
 
 
8
from zope.component import getUtility
 
9
 
 
10
from canonical.testing.layers import DatabaseFunctionalLayer
 
11
from lp.soyuz.interfaces.binarypackagepath import IBinaryPackagePathSource
 
12
from lp.testing import TestCaseWithFactory
 
13
 
 
14
 
 
15
class TestBinaryPackagePath(TestCaseWithFactory):
 
16
 
 
17
    layer = DatabaseFunctionalLayer
 
18
 
 
19
    def test_get_or_create(self):
 
20
        bpp = getUtility(IBinaryPackagePathSource).getOrCreate(u'bin/bash')
 
21
        self.assertEqual(u'bin/bash', bpp.path)
 
22
 
 
23
    def test_get_or_create_existing(self):
 
24
        orig_bpp = getUtility(IBinaryPackagePathSource).getOrCreate(
 
25
            u'bin/bash')
 
26
        bpp = getUtility(IBinaryPackagePathSource).getOrCreate(u'bin/bash')
 
27
        self.assertEqual(orig_bpp.id, bpp.id)