diff options
| author | Christian Schwede <cschwede@redhat.com> | 2016-08-18 09:44:03 +0000 |
|---|---|---|
| committer | Christian Schwede <cschwede@redhat.com> | 2016-09-06 07:38:08 +0000 |
| commit | 89ff29e788479334c218801beb0538b4a6bddf23 (patch) | |
| tree | e34fd707820cbdf4b31849bef902ed566316a671 /tests | |
| parent | cbd71a8b5a7339f3ed297ae410a4836b2d56634a (diff) | |
| download | python-swiftclient-89ff29e788479334c218801beb0538b4a6bddf23.tar.gz | |
Make options arguments truely optional
Currently the options help, info and debug must exist in the options
dictionary; however it might be that this is not the case if a method is
imported externally. This patch fixes this.
Also support using a storage URL or path as an argument for tempurl, and
adding a test to verify correct output in both cases.
Related-Bug: 1607519
Related-Bug: 1607523
Closes-Bug: 1607521
Change-Id: I0fb2ce125fe12d660e4deb778265016bdd5ff31b
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/unit/test_shell.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/unit/test_shell.py b/tests/unit/test_shell.py index c0fcc41..40881c2 100644 --- a/tests/unit/test_shell.py +++ b/tests/unit/test_shell.py @@ -1412,6 +1412,22 @@ class TestShell(unittest.TestCase): temp_url.assert_called_with( '/v1/AUTH_account/c/o', 60, 'secret_key', 'GET', absolute=True) + def test_temp_url_output(self): + argv = ["", "tempurl", "GET", "60", "/v1/a/c/o", + "secret_key", "--absolute"] + with CaptureOutput(suppress_systemexit=True) as output: + swiftclient.shell.main(argv) + sig = "63bc77a473a1c2ce956548cacf916f292eb9eac3" + expected = "/v1/a/c/o?temp_url_sig=%s&temp_url_expires=60\n" % sig + self.assertEqual(expected, output.out) + + argv = ["", "tempurl", "GET", "60", "http://saio:8080/v1/a/c/o", + "secret_key", "--absolute"] + with CaptureOutput(suppress_systemexit=True) as output: + swiftclient.shell.main(argv) + expected = "http://saio:8080%s" % expected + self.assertEqual(expected, output.out) + @mock.patch('swiftclient.service.Connection') def test_capabilities(self, connection): argv = ["", "capabilities"] |
