Skip to content

Commit aeb4646

Browse files
committed
refactor more tests
1 parent 3165ace commit aeb4646

File tree

3 files changed

+9
-13
lines changed

3 files changed

+9
-13
lines changed

pre_push_verifications.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ black bin/ tests/ hpecp/
99
#flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
1010
flake8 --exclude hpecp/role.py --docstring-convention numpy bin/ hpecp/
1111

12-
flake8 --ignore=D,E501 tests/catalog_test.py tests/base_test.py tests/cli_test.py
12+
flake8 --ignore=D,E501 tests/catalog_test.py tests/base_test.py tests/cli_test.py tests/client_test.py tests/config_test.py tests/gateway_test.py
1313

1414
tox -e py35 -- tests/
1515

tests/client_test.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ class TestCreateFromEnvVar(TestCase):
9292
def test_create_from_env_var_factory_method_with_missing_env_values(self):
9393

9494
try:
95-
client = ContainerPlatformClient.create_from_env()
95+
ContainerPlatformClient.create_from_env()
9696
except ContainerPlatformClientException as expected:
9797
self.assertEqual(
9898
expected.message,
@@ -114,7 +114,7 @@ def test_create_from_env_var_factory_method_with_missing_env_values(self):
114114
def test_create_from_env_var_factory_method_with_type_error(self):
115115

116116
try:
117-
client = ContainerPlatformClient.create_from_env()
117+
ContainerPlatformClient.create_from_env()
118118
except ContainerPlatformClientException as expected:
119119
self.assertEqual(
120120
expected.message,

tests/gateway_test.py

+6-10
Original file line numberDiff line numberDiff line change
@@ -18,26 +18,22 @@
1818
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
1919
# OTHER DEALINGS IN THE SOFTWARE.
2020

21-
import os
22-
import sys
2321
import tempfile
24-
from textwrap import dedent
2522
from unittest import TestCase
2623

2724
import requests
28-
import six
29-
from mock import Mock, patch
25+
from mock import patch
3026

3127
from hpecp import APIItemNotFoundException, ContainerPlatformClient
3228
from hpecp.exceptions import APIItemConflictException
3329
from hpecp.gateway import GatewayController, GatewayStatus
3430

3531
from .base_test import BaseTestCase
3632

37-
if six.PY2:
38-
from io import BytesIO as StringIO
39-
else:
40-
from io import StringIO
33+
# if six.PY2:
34+
# from io import BytesIO as StringIO
35+
# else:
36+
# from io import StringIO
4137

4238

4339
class MockResponse:
@@ -1057,7 +1053,7 @@ def test_create_with_ssh_key_assertions(self, mock_post):
10571053
@patch("requests.post", side_effect=mocked_requests_create_post)
10581054
def test_create_with_ssh_key_returns_id(self, mock_post):
10591055

1060-
id = get_client().gateway.create_with_ssh_key(
1056+
get_client().gateway.create_with_ssh_key(
10611057
ip="127.0.0.1",
10621058
proxy_node_hostname="my.host.name",
10631059
ssh_key_data="pem encoded key data",

0 commit comments

Comments
 (0)