Skip to content

Commit

Permalink
add error status attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielburnworth committed Jul 25, 2024
1 parent f220bb3 commit 0df6121
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ def __init__(self):
self.broker = BrokerFunctions()

self.token = None
self.error = None

## SETUP

Expand All @@ -16,6 +17,7 @@ def get_token(self, email, password, server="https://my.farm.bot"):
token_data = self.api.get_token(email, password, server)

self.token = token_data
self.error = self.api.api_connect.error

# Set broker tokens
self.broker.broker_connect.token = self.api.api_connect.token
Expand Down
4 changes: 2 additions & 2 deletions testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def test_get_token_bad_email(self, mock_post):
headers={'content-type': 'application/json'},
json={'user': {'email': '[email protected]', 'password': 'test_pass_123'}}
)
# self.assertEqual(fb.error, 'ERROR: Incorrect email address or password.')
self.assertEqual(fb.error, 'HTTP ERROR: Incorrect email address or password.')
self.assertIsNone(fb.token)
self.assertEqual(mock_post.return_value.status_code, 422)

Expand All @@ -80,7 +80,7 @@ def test_get_token_bad_server(self, mock_post):
headers={'content-type': 'application/json'},
json={'user': {'email': '[email protected]', 'password': 'test_pass_123'}}
)
# self.assertEqual(fb.error, 'ERROR: The server address does not exist.')
self.assertEqual(fb.error, 'HTTP ERROR: The server address does not exist.')
self.assertIsNone(fb.token)
self.assertEqual(mock_post.return_value.status_code, 404)

Expand Down

0 comments on commit 0df6121

Please sign in to comment.