diff options
| author | jichenjc <jichenjc@cn.ibm.com> | 2016-02-21 08:30:54 +0800 |
|---|---|---|
| committer | jichenjc <jichenjc@cn.ibm.com> | 2016-02-23 12:23:10 +0800 |
| commit | 042e2b7d53222618c76870effa3d74759ccc696a (patch) | |
| tree | 92d2b7aa579244c67b1fe128061ea9304e08faf5 /openstackclient/compute | |
| parent | b5b5fdd78ad0d191bdf07a56293fecaa43002e75 (diff) | |
| download | python-openstackclient-042e2b7d53222618c76870effa3d74759ccc696a.tar.gz | |
[compute] Add unit test for keypair
keypair do not have unit test, this patch adds it.
Change-Id: Id702ccaad239b916340bb17014d1ede0a28aaec9
Diffstat (limited to 'openstackclient/compute')
| -rw-r--r-- | openstackclient/compute/v2/keypair.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/openstackclient/compute/v2/keypair.py b/openstackclient/compute/v2/keypair.py index 71c9d674..22d918a4 100644 --- a/openstackclient/compute/v2/keypair.py +++ b/openstackclient/compute/v2/keypair.py @@ -15,6 +15,7 @@ """Keypair action implementations""" +import io import os import six import sys @@ -47,7 +48,8 @@ class CreateKeypair(command.ShowOne): public_key = parsed_args.public_key if public_key: try: - with open(os.path.expanduser(parsed_args.public_key)) as p: + with io.open(os.path.expanduser(parsed_args.public_key), + "rb") as p: public_key = p.read() except IOError as e: msg = "Key file %s not found: %s" |
