fix tests
This commit is contained in:
parent
4a168d5460
commit
10c1f4b11b
@ -109,7 +109,7 @@ class ShellTest(utils.TestCase):
|
|||||||
@mock.patch('os.path.exists', mock_exists)
|
@mock.patch('os.path.exists', mock_exists)
|
||||||
@mock.patch('__builtin__.open', mock_open)
|
@mock.patch('__builtin__.open', mock_open)
|
||||||
def test_shell_call():
|
def test_shell_call():
|
||||||
self.run_command('boot some-server --flavor 1 --image 1 --key')
|
self.run_command('boot some-server --flavor 1 --image 1 --key_path')
|
||||||
self.assert_called_anytime(
|
self.assert_called_anytime(
|
||||||
'POST', '/servers',
|
'POST', '/servers',
|
||||||
{'server': {
|
{'server': {
|
||||||
@ -133,14 +133,14 @@ class ShellTest(utils.TestCase):
|
|||||||
@mock.patch('os.path.exists', mock_exists)
|
@mock.patch('os.path.exists', mock_exists)
|
||||||
def test_shell_call():
|
def test_shell_call():
|
||||||
self.assertRaises(exceptions.CommandError, self.run_command,
|
self.assertRaises(exceptions.CommandError, self.run_command,
|
||||||
'boot some-server --flavor 1 --image 1 --key')
|
'boot some-server --flavor 1 --image 1 --key_path')
|
||||||
|
|
||||||
test_shell_call()
|
test_shell_call()
|
||||||
|
|
||||||
def test_boot_key_file(self):
|
def test_boot_key_file(self):
|
||||||
testfile = os.path.join(os.path.dirname(__file__), 'testfile.txt')
|
testfile = os.path.join(os.path.dirname(__file__), 'testfile.txt')
|
||||||
expected_file_data = open(testfile).read().encode('base64')
|
expected_file_data = open(testfile).read().encode('base64')
|
||||||
cmd = 'boot some-server --flavor 1 --image 1 --key %s'
|
cmd = 'boot some-server --flavor 1 --image 1 --key_path %s'
|
||||||
self.run_command(cmd % testfile)
|
self.run_command(cmd % testfile)
|
||||||
self.assert_called_anytime(
|
self.assert_called_anytime(
|
||||||
'POST', '/servers',
|
'POST', '/servers',
|
||||||
@ -160,7 +160,7 @@ class ShellTest(utils.TestCase):
|
|||||||
def test_boot_invalid_keyfile(self):
|
def test_boot_invalid_keyfile(self):
|
||||||
invalid_file = os.path.join(os.path.dirname(__file__),
|
invalid_file = os.path.join(os.path.dirname(__file__),
|
||||||
'asdfasdfasdfasdf')
|
'asdfasdfasdfasdf')
|
||||||
cmd = 'boot some-server --flavor 1 --image 1 --key %s'
|
cmd = 'boot some-server --flavor 1 --image 1 --key_path %s'
|
||||||
self.assertRaises(exceptions.CommandError, self.run_command,
|
self.assertRaises(exceptions.CommandError, self.run_command,
|
||||||
cmd % invalid_file)
|
cmd % invalid_file)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user