Skip to content

Commit

Permalink
GDrive mocks are specific to sonny source
Browse files Browse the repository at this point in the history
  • Loading branch information
agrenott committed Jan 2, 2024
1 parent 92ee78b commit abd4d5d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 21 deletions.
20 changes: 0 additions & 20 deletions tests/sources/conftest.py

This file was deleted.

17 changes: 16 additions & 1 deletion tests/sources/test_sonny.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
from io import BytesIO
from pathlib import Path
from tempfile import TemporaryDirectory
from unittest.mock import MagicMock
from typing import Generator
from unittest.mock import MagicMock, patch
from zipfile import ZipFile

import pytest
Expand All @@ -11,6 +12,20 @@
from pyhgtmap.sources.sonny import CLIENT_SECRET_FILE, SAVED_CREDENTIALS_FILE, Sonny


@pytest.fixture
def gauth_mock() -> Generator[MagicMock, None, None]:
"""Mock pyhgtmap.sources.sonny.GoogleAuth"""
with patch("pyhgtmap.sources.sonny.GoogleAuth") as gauth_mock:
yield gauth_mock


@pytest.fixture
def gdrive_mock() -> Generator[MagicMock, None, None]:
"""Mock pyhgtmap.sources.sonny.GoogleDrive"""
with patch("pyhgtmap.sources.sonny.GoogleDrive") as gdrive_mock:
yield gdrive_mock


def get_hgt_zipped_file(file_base_name: str, file_size: int) -> BytesIO:
"""Generate and zip a fake .HGT file"""
# We don't care about content
Expand Down

0 comments on commit abd4d5d

Please sign in to comment.