starting ResolutionProviderTest

This commit is contained in:
frankknoll
2023-10-03 19:22:07 +02:00
parent 22ee70d111
commit ac6435de7d
6 changed files with 1505 additions and 22 deletions

3
.gitignore vendored
View File

@@ -14,4 +14,5 @@ src/HowBadIsMyBatch.nbconvert.html
src/__pycache__/
src/intensivstationen/__pycache__/
google-chrome-stable_current_amd64*
src/captcha/__pycache__
src/captcha/__pycache__
src/GoogleAnalytics/__pycache__

View File

@@ -0,0 +1,15 @@
from enum import Enum
import linecache
class Resolution(Enum):
CITY = 1
COUNTRY = 2
class ResolutionProvider:
@staticmethod
def getResolution(file):
columns = linecache.getline(file, 7)
return Resolution.CITY if 'City' in columns else Resolution.COUNTRY

View File

@@ -0,0 +1,23 @@
import unittest
from GoogleAnalytics.ResolutionProvider import Resolution, ResolutionProvider
class ResolutionProviderTest(unittest.TestCase):
def test_getResolution_COUNTRY(self):
# Given
# When
resolution = ResolutionProvider.getResolution('src/testdata/GoogleAnalytics/CountryByBatchcode 20230302-20230430.csv')
# Then
self.assertEqual(resolution, Resolution.COUNTRY)
def test_getResolution_CITY(self):
# Given
# When
resolution = ResolutionProvider.getResolution('src/testdata/GoogleAnalytics/CountryByBatchcode 20230730-20230929.csv')
# Then
self.assertEqual(resolution, Resolution.CITY)

View File

View File

@@ -12,4 +12,4 @@ class GoogleAnalyticsReaderTest(unittest.TestCase):
dateRange = googleAnalyticsReader.getDateRange()
# Then
self.assertEqual(dateRange, (date(2023, 3, 2), date(2023, 5, 31)))
self.assertEqual(dateRange, (date(2023, 3, 2), date(2023, 9, 29)))

File diff suppressed because it is too large Load Diff