Fix prompt_optionlist test.

The problem was passing a dict when fake_prompt_optionlist

Also using "new_callable" instead of "new" argument for @patch
This commit is contained in:
Ryan Brown 2013-03-27 19:27:56 -04:00
parent 3295edbfcc
commit bb61793442
1 changed files with 13 additions and 11 deletions

View File

@ -12,10 +12,9 @@ import tempfile
def fake_prompt_optionlist(input_list):
def fakereturns():
def fr(_):
return input_list.pop(0)
return fakereturns
return fr
class TestThong(unittest.TestCase):
@ -27,16 +26,19 @@ class TestThong(unittest.TestCase):
print "TEAR DOWN"
@patch("pythong.project.prompt_optionlist",
new_callable=fake_prompt_optionlist([{"Development Status": None,
"None": None,
"Operating Systems": None,
"Linux": None,
"Fedora": None}]))
def test_optionlist(self, arg2):
print arg2
new=fake_prompt_optionlist(["Development Status",
None,
"Operating System",
"POSIX",
"Linux"]
)
)
def test_optionlist(self):
from pythong.classifiers import CLASSIFIERS
from pythong.project import recurse_prompt
assert(recurse_prompt(CLASSIFIERS) == "Operating Systems :: Linux :: Fedora")
assert(recurse_prompt(CLASSIFIERS) is None)
assert(recurse_prompt(CLASSIFIERS) == "Operating System :: POSIX :: Linux")
if __name__ == '__main__':
unittest.main()