Skip to content

Commit

Permalink
WC-3138: tests: Clean up issues spotted by pyflakes
Browse files Browse the repository at this point in the history
  • Loading branch information
sjlongland committed Sep 3, 2020
1 parent 16aa6d6 commit 8f64531
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
9 changes: 4 additions & 5 deletions tests/client/test_entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

from pyhaystack.client.http import dummy as dummy_http
from pyhaystack.client.entity.entity import Entity
from ..util import grid_cmp

# For simplicity's sake, we'll just use the WideSky client.
# Pretend we're version 0.0.1.
Expand All @@ -22,8 +21,6 @@
import hszinc

# For date/time generation
import datetime
import pytz
import time

# Logging setup so we can see what's going on
Expand Down Expand Up @@ -242,8 +239,9 @@ def test_get_multi_entity_missng(self, server_session):
# State machine should now be done
assert op.is_done
entities = op.result

# Response should be a dict
assert isinstance(entities, dict), "%r not a dict" % entity
assert isinstance(entities, dict), "%r not a dict" % entities
# Response should have these keys
assert set(entities.keys()) == set(["my.entity.id1", "my.entity.id2"])

Expand Down Expand Up @@ -331,8 +329,9 @@ def test_get_multi_entity(self, server_session):
# State machine should now be done
assert op.is_done
entities = op.result

# Response should be a dict
assert isinstance(entities, dict), "%r not a dict" % entity
assert isinstance(entities, dict), "%r not a dict" % entities
# Response should have these keys
assert set(entities.keys()) == set(["my.entity.id1", "my.entity.id2"])

Expand Down
9 changes: 4 additions & 5 deletions tests/test_widesky.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,13 @@
from pyhaystack.client.http.base import HTTPResponse
from pyhaystack.client.http.exceptions import HTTPStatusError
from pyhaystack.util.asyncexc import AsynchronousException
from .util import grid_cmp

from pyhaystack.client import widesky

# hszinc has its own tests, we'll assume they work
import hszinc

# For date/time generation
import datetime
import pytz
import time

# JSON encoding/decoding
Expand All @@ -32,8 +29,6 @@

logging.basicConfig(level=logging.DEBUG)

from pyhaystack.client import widesky

BASE_URI = "https://myserver/api/"


Expand Down Expand Up @@ -113,6 +108,7 @@ def test_impersonate_is_set_in_client_header(self):
assert session._client.headers["X-IMPERSONATE"] is user_id


@pytest.mark.usefixtures("server_session")
class TestUpdatePassword(object):
"""
Test the update_password op
Expand All @@ -124,6 +120,9 @@ def test_update_pwd_endpoint_is_called(self, server_session):
# Issue the request
op = session.update_password("hello123X")

# Make sure there's no error during set-up.
assert (not op.is_done) or (op.result is None)

# Pop the request off the stack and inspect it
rq = server.next_request()
assert server.requests() == 0, "More requests waiting"
Expand Down

0 comments on commit 8f64531

Please sign in to comment.