diff options
| author | Brian Haley <bhaley@redhat.com> | 2019-05-09 15:08:54 -0400 |
|---|---|---|
| committer | Brian Haley <haleyb.dev@gmail.com> | 2019-05-10 15:47:09 +0000 |
| commit | 4b91cd49658bd5a9224976ebd3a6f352d1eef5b0 (patch) | |
| tree | fc8cb3028c36fcf78593d7272e02c2f251df30be /openstackclient/tests/unit/test_shell.py | |
| parent | 1bc44fcdc6c96bbffdd70c57f6cb11b5c1278071 (diff) | |
| download | python-openstackclient-4b91cd49658bd5a9224976ebd3a6f352d1eef5b0.tar.gz | |
Stop leaving temp files after unit test runs
test_shell.CLOUD_2 is using an absolute path for a temp
file, so leaves /tmp/test_log_file around after the unit
tests are run. Use a fixture instead so it's cleaned
automatically, which also removes the possibility of two
tests using the same file and interfering with each other.
Change-Id: If722b860be4010b91635c6d46f634da980e17152
Diffstat (limited to 'openstackclient/tests/unit/test_shell.py')
| -rw-r--r-- | openstackclient/tests/unit/test_shell.py | 37 |
1 files changed, 20 insertions, 17 deletions
diff --git a/openstackclient/tests/unit/test_shell.py b/openstackclient/tests/unit/test_shell.py index dff37f10..5d413e7e 100644 --- a/openstackclient/tests/unit/test_shell.py +++ b/openstackclient/tests/unit/test_shell.py @@ -70,23 +70,6 @@ CLOUD_1 = { } } -CLOUD_2 = { - 'clouds': { - 'megacloud': { - 'cloud': 'megadodo', - 'auth': { - 'project_name': 'heart-o-gold', - 'username': 'zaphod', - }, - 'region_name': 'occ-cloud,krikkit,occ-env', - 'log_file': '/tmp/test_log_file', - 'log_level': 'debug', - 'cert': 'mycert', - 'key': 'mickey', - } - } -} - PUBLIC_1 = { 'public-clouds': { 'megadodo': { @@ -118,6 +101,26 @@ global_options = { } +def get_cloud(log_file): + CLOUD = { + 'clouds': { + 'megacloud': { + 'cloud': 'megadodo', + 'auth': { + 'project_name': 'heart-o-gold', + 'username': 'zaphod', + }, + 'region_name': 'occ-cloud,krikkit,occ-env', + 'log_file': log_file, + 'log_level': 'debug', + 'cert': 'mycert', + 'key': 'mickey', + } + } + } + return CLOUD + + # Wrap the osc_lib make_shell() function to set the shell class since # osc-lib's TestShell class doesn't allow us to specify it yet. # TODO(dtroyer): remove this once the shell_class_patch patch is released |
