diff --git a/tests/test_crawl_tasks.py b/tests/test_crawl_tasks.py index 4c20a2d..4b8771d 100644 --- a/tests/test_crawl_tasks.py +++ b/tests/test_crawl_tasks.py @@ -25,9 +25,13 @@ def test_get_tasks_existing_token_valid(): - with patch("os.path.exists", return_value=True), patch( - "google.oauth2.credentials.Credentials.from_authorized_user_file" - ) as mock_cred, patch("googleapiclient.discovery.build") as mock_build: + with ( + patch("os.path.exists", return_value=True), + patch( + "google.oauth2.credentials.Credentials.from_authorized_user_file" + ) as mock_cred, + patch("googleapiclient.discovery.build") as mock_build, + ): mock_cred.return_value.valid = True mock_cred.return_value.universe_domain = "googleapis.com" @@ -51,12 +55,14 @@ def test_get_tasks_existing_token_valid(): def test_get_tasks_existing_token_expired(): - with patch("os.path.exists", return_value=True), patch( - "google.oauth2.credentials.Credentials.from_authorized_user_file" - ) as mock_cred, patch("google.auth.transport.requests.Request"), patch( - "googleapiclient.discovery.build" - ) as mock_build, patch( - "builtins.open", mock_open() + with ( + patch("os.path.exists", return_value=True), + patch( + "google.oauth2.credentials.Credentials.from_authorized_user_file" + ) as mock_cred, + patch("google.auth.transport.requests.Request"), + patch("googleapiclient.discovery.build") as mock_build, + patch("builtins.open", mock_open()), ): # Setup mock credentials mock_cred.return_value.valid = False @@ -71,9 +77,9 @@ def refresh(request): # Setup Google API client mock mock_service = mock_build.return_value - mock_tasklists = ( - mock_service.tasklists().list().execute.return_value - ) = MOCK_TASKLISTS + mock_tasklists = mock_service.tasklists().list().execute.return_value = ( + MOCK_TASKLISTS + ) mock_tasks = mock_service.tasks().list().execute.return_value = MOCK_TASKS # Execute function @@ -85,9 +91,13 @@ def refresh(request): def test_get_tasks_no_tasklists(): - with patch("os.path.exists", return_value=True), patch( - "google.oauth2.credentials.Credentials.from_authorized_user_file" - ) as mock_cred, patch("googleapiclient.discovery.build") as mock_build: + with ( + patch("os.path.exists", return_value=True), + patch( + "google.oauth2.credentials.Credentials.from_authorized_user_file" + ) as mock_cred, + patch("googleapiclient.discovery.build") as mock_build, + ): # Setup mock credentials mock_cred.return_value.valid = True