Change defaults for --url
Defaults for --url param has been changed to env[REFSTACK_URL] if it is set and 'http://api.refstack.net' if env[REFSTACK_URL] is not set. It will be helpull during development and for upload to local refstack server. Change-Id: I8de8dfba1f6741133585815ace5cfd2ca2780fa2
This commit is contained in:
@@ -52,7 +52,7 @@ class TestRefstackClient(unittest.TestCase):
|
||||
:return: argv
|
||||
"""
|
||||
argv = [command,
|
||||
'--url', 'http://127.0.0.1']
|
||||
'--url', 'http://127.0.0.1', '-y']
|
||||
if command == 'test':
|
||||
argv.extend(
|
||||
('-c', kwargs.get('conf_file_name', self.conf_file_name)))
|
||||
@@ -228,6 +228,19 @@ class TestRefstackClient(unittest.TestCase):
|
||||
]
|
||||
self.assertEqual(expected, results)
|
||||
|
||||
@mock.patch('six.moves.input')
|
||||
def test_user_query(self, mock_input):
|
||||
client = rc.RefstackClient(rc.parse_cli_args(self.mock_argv()))
|
||||
self.assertTrue(client._user_query('42?'))
|
||||
|
||||
mock_input.return_value = 'n'
|
||||
cli_args = self.mock_argv()
|
||||
cli_args.remove('-y')
|
||||
client = rc.RefstackClient(rc.parse_cli_args(cli_args))
|
||||
self.assertFalse(client._user_query('42?'))
|
||||
mock_input.return_value = 'yes'
|
||||
self.assertTrue(client._user_query('42?'))
|
||||
|
||||
def test_post_results(self):
|
||||
"""
|
||||
Test the post_results method, ensuring a requests call is made.
|
||||
@@ -435,8 +448,8 @@ class TestRefstackClient(unittest.TestCase):
|
||||
Test that the upload command runs as expected.
|
||||
"""
|
||||
upload_file_path = self.test_path + "/.testrepository/0.json"
|
||||
args = rc.parse_cli_args(['upload', upload_file_path,
|
||||
'--url', 'http://api.test.org'])
|
||||
args = rc.parse_cli_args(
|
||||
self.mock_argv(command='upload') + [upload_file_path])
|
||||
client = rc.RefstackClient(args)
|
||||
|
||||
client.post_results = MagicMock()
|
||||
@@ -450,7 +463,7 @@ class TestRefstackClient(unittest.TestCase):
|
||||
'uuid': '0146f675-ffbd-4208-b3a4-60eb628dbc5e'}
|
||||
]
|
||||
}
|
||||
client.post_results.assert_called_with('http://api.test.org',
|
||||
client.post_results.assert_called_with('http://127.0.0.1',
|
||||
expected_json,
|
||||
sign_with=None)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user