8687.15.17
by Karl Fogel
Add the copyright header block to the rest of the files under lib/lp/. |
1 |
# Copyright 2009 Canonical Ltd. This software is licensed under the
|
2 |
# GNU Affero General Public License version 3 (see the file LICENSE).
|
|
7368.4.6
by Guilherme Salgado
add test_pillar.py |
3 |
|
4 |
"""Unit tests for methods of PillarName and PillarNameSet."""
|
|
5 |
||
6 |
from zope.component import getUtility |
|
7 |
||
14612.2.1
by William Grant
format-imports on lib/. So many imports. |
8 |
from lp.registry.interfaces.pillar import IPillarNameSet |
9 |
from lp.testing import ( |
|
10 |
login, |
|
11 |
TestCaseWithFactory, |
|
12 |
)
|
|
14604.1.1
by Curtis Hovey
Separate test-authoring classes from test-running classes. |
13 |
from lp.testing.layers import LaunchpadFunctionalLayer |
7368.4.6
by Guilherme Salgado
add test_pillar.py |
14 |
|
15 |
||
16 |
class TestPillarNameSet(TestCaseWithFactory): |
|
17 |
layer = LaunchpadFunctionalLayer |
|
18 |
||
19 |
def test_search_correctly_ranks_by_aliases(self): |
|
20 |
"""When we use a pillar's alias to search, that pillar will be the
|
|
21 |
first one on the list.
|
|
22 |
"""
|
|
9105.3.2
by Brad Crittenden
Changed mark@hbd.com to mark@example.com. Tests that used base64 encoding for basic auth credentials were changed to use plaintext. |
23 |
login('mark@example.com') |
7368.4.6
by Guilherme Salgado
add test_pillar.py |
24 |
lz_foo = self.factory.makeProduct(name='lz-foo') |
25 |
lz_bar = self.factory.makeProduct(name='lz-bar') |
|
26 |
launchzap = self.factory.makeProduct(name='launchzap') |
|
27 |
launchzap.setAliases(['lz']) |
|
28 |
pillar_set = getUtility(IPillarNameSet) |
|
29 |
result_names = [ |
|
30 |
pillar.name for pillar in pillar_set.search('lz', limit=5)] |
|
31 |
self.assertEquals(result_names, [u'launchzap', u'lz-bar', u'lz-foo']) |