Skip to content

Commit 4ef7d2c

Browse files
committed
Fixed result.startswith conflicting with Mock.
1 parent af36fc1 commit 4ef7d2c

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

nut2.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,13 +124,13 @@ def _connect(self):
124124
if self._login != None:
125125
self._srv_handler.write("USERNAME %s\n" % self._login)
126126
result = self._srv_handler.read_until("\n", self._timeout)
127-
if not result.startswith("OK"):
127+
if not result == "OK\n":
128128
raise PyNUTError(result.replace("\n", ""))
129129

130130
if self._password != None:
131131
self._srv_handler.write("PASSWORD %s\n" % self._password)
132132
result = self._srv_handler.read_until("\n", self._timeout)
133-
if not result.startswith("OK"):
133+
if not result == "OK\n":
134134
raise PyNUTError(result.replace("\n", ""))
135135

136136
def list_ups(self):

tests/testclient.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ def test_connect_broken(self):
5555

5656
def test_connect_credentials(self):
5757
try:
58-
PyNUTClient(login=self.valid, password=self.valid)
58+
PyNUTClient(login=self.valid, password=self.valid,
59+
debug=True)
5960
except TypeError:
6061
pass
6162
except PyNUTError:

0 commit comments

Comments
 (0)