From 042e2b7d53222618c76870effa3d74759ccc696a Mon Sep 17 00:00:00 2001 From: jichenjc Date: Sun, 21 Feb 2016 08:30:54 +0800 Subject: [compute] Add unit test for keypair keypair do not have unit test, this patch adds it. Change-Id: Id702ccaad239b916340bb17014d1ede0a28aaec9 --- openstackclient/compute/v2/keypair.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'openstackclient/compute') 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" -- cgit v1.2.1