Fixes for flake8

This commit is contained in:
Ammar Askar 2019-01-04 20:12:07 -05:00
parent 6adefa8c75
commit b4c58477f4

View File

@ -327,7 +327,7 @@ class NormalConnectionProcedure(unittest.TestCase):
self.assertFalse(a.authenticated)
self.assertTrue(a.authenticate("username", "password"))
_make_request_mock.assert_called_once()
self.assertEqual(_make_request_mock.call_count, 1)
self.assertIn("clientToken", _make_request_mock.call_args[0][2])
self.assertTrue(a.authenticated)
@ -350,10 +350,14 @@ class NormalConnectionProcedure(unittest.TestCase):
side_effect=mocked_make_request) as _make_request_mock:
a = AuthenticationToken(client_token="existing_token")
self.assertTrue(a.authenticate("username", "password", invalidate_previous=False))
self.assertTrue(a.authenticate("username", "password",
invalidate_previous=False))
_make_request_mock.assert_called_once()
self.assertEqual("existing_token", _make_request_mock.call_args[0][2]["clientToken"])
self.assertEqual(_make_request_mock.call_count, 1)
self.assertEqual(
"existing_token",
_make_request_mock.call_args[0][2]["clientToken"]
)
# Test that we invalidate previous tokens properly
with mock.patch("minecraft.authentication._make_request",
@ -361,13 +365,12 @@ class NormalConnectionProcedure(unittest.TestCase):
a = AuthenticationToken()
self.assertFalse(a.authenticated)
self.assertTrue(
a.authenticate("username", "password", invalidate_previous=True)
)
self.assertTrue(a.authenticate("username", "password",
invalidate_previous=True))
self.assertTrue(a.authenticated)
self.assertEqual(a.access_token, "token")
_make_request_mock.assert_called_once()
self.assertEqual(_make_request_mock.call_count, 1)
self.assertNotIn("clientToken", _make_request_mock.call_args[0][2])
a = AuthenticationToken(username="username",