Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Jun 17, 2024
1 parent e6e3ba2 commit 34b3763
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ Create a .env file in the root of the project with the following content::
YOTO_PASSWORD=your_password

Run the tests with::

python -m pytest

Other Notes
Expand Down
2 changes: 1 addition & 1 deletion requirements_dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ pytz
requests
paho-mqtt
pytest
python-dotenv
python-dotenv
14 changes: 8 additions & 6 deletions tests/YotoAPI_test.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@

import unittest
from dotenv import load_dotenv
import os
import pytz
from yoto_api.YotoAPI import YotoAPI
from datetime import datetime, timedelta
from datetime import datetime


class ValidLogin(unittest.TestCase):
@classmethod
def setUpClass(cls):
load_dotenv()
load_dotenv()
username = os.getenv("USERNAME")
password = os.getenv("PASSWORD")
api = YotoAPI()
Expand All @@ -30,14 +30,16 @@ def test_scope(self):
def test_valid_until_is_greater_than_now(self):
self.assertGreater(self.token.valid_until, datetime.now(pytz.utc))


class InvalidLogin(unittest.TestCase):
def test_it_throws_an_error(self):
api = YotoAPI()

with self.assertRaises(Exception) as error:
api.login("invalid", "invalid")

self.assertEqual(str(error.exception), "Wrong email or password.")

if __name__ == '__main__':
unittest.main()

if __name__ == "__main__":
unittest.main()

0 comments on commit 34b3763

Please sign in to comment.