7675.1203.4
by Steve Kowalik
* BinaryPackagePaths -> BinaryPackagePath. |
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 |
|
7675.1203.9
by Steve Kowalik
* BinaryPackagePathSource -> BinaryPackagePathSet. |
11 |
from lp.soyuz.interfaces.binarypackagepath import IBinaryPackagePathSet |
7675.1203.4
by Steve Kowalik
* BinaryPackagePaths -> BinaryPackagePath. |
12 |
from lp.testing import TestCaseWithFactory |
13 |
||
14 |
||
15 |
class TestBinaryPackagePath(TestCaseWithFactory): |
|
16 |
||
17 |
layer = DatabaseFunctionalLayer |
|
18 |
||
7675.1203.9
by Steve Kowalik
* BinaryPackagePathSource -> BinaryPackagePathSet. |
19 |
def test_getOrCreate(self): |
7675.1203.11
by Steve Kowalik
Switch from text to bytea, allowing us to store non-UTF8 data. |
20 |
bpp = getUtility(IBinaryPackagePathSet).getOrCreate('bin/bash') |
21 |
self.assertEqual('bin/bash', bpp.path) |
|
7675.1203.4
by Steve Kowalik
* BinaryPackagePaths -> BinaryPackagePath. |
22 |
|
7675.1203.11
by Steve Kowalik
Switch from text to bytea, allowing us to store non-UTF8 data. |
23 |
def test_getOrCreate_existing(self): |
24 |
orig_bpp = getUtility(IBinaryPackagePathSet).getOrCreate('bin/bash') |
|
25 |
bpp = getUtility(IBinaryPackagePathSet).getOrCreate('bin/bash') |
|
7675.1203.4
by Steve Kowalik
* BinaryPackagePaths -> BinaryPackagePath. |
26 |
self.assertEqual(orig_bpp.id, bpp.id) |