Skip to content

Commit 7b7446b

Browse files
Merge pull request #2188 from allmightyspiff/issues2130
Fixed an issues with search command.
2 parents 967ef16 + 174f8c1 commit 7b7446b

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

Diff for: SoftLayer/CLI/search.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,14 @@ def cli(env, query, types, advanced):
3737
slcli -vvv search _objectType:SoftLayer_Hardware hostname:testibm --advanced
3838
"""
3939

40-
# Before any Search operation
40+
# Checks to make sure we have at least 1 query.
4141
def check_opt(list_opt=None):
4242
check = False
4343
for input_ in list_opt:
44-
if input_ is True:
44+
if input_:
4545
check = True
4646
break
47+
4748
return check
4849

4950
list_opt = [query, types, advanced]

Diff for: tests/CLI/modules/search_tests.py

+10-3
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,30 @@
11
"""
2-
SoftLayer.tests.CLI.modules.find_tests
3-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2+
SoftLayer.tests.CLI.modules.search_tests
3+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
44
55
:license: MIT, see LICENSE for more details.
66
"""
77

88
from SoftLayer import testing
99

1010

11-
class FindTests(testing.TestCase):
11+
class SearchTests(testing.TestCase):
1212

1313
def test_find(self):
1414
result = self.run_command(['search', '--types'])
15+
self.assert_called_with("SoftLayer_Search", "getObjectTypes")
1516
self.assert_no_fail(result)
1617

1718
def test_find_advanced(self):
1819
result = self.run_command(['search', 'hardware', '--advanced'])
20+
self.assert_called_with("SoftLayer_Search", "advancedSearch", args=('hardware',))
1921
self.assert_no_fail(result)
2022

2123
def test_no_options(self):
2224
result = self.run_command(['search'])
2325
self.assertEqual(result.exit_code, 2)
26+
27+
def test_find_single_item(self):
28+
result = self.run_command(['search', 'test.com'])
29+
self.assert_no_fail(result)
30+
self.assert_called_with("SoftLayer_Search", "search", args=('test.com',))

0 commit comments

Comments
 (0)