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