diff --git a/src/CountryCountsByClickedBatchcodeProviderTest.py b/src/CountryCountsByClickedBatchcodeProviderTest.py new file mode 100644 index 00000000000..11824f162f8 --- /dev/null +++ b/src/CountryCountsByClickedBatchcodeProviderTest.py @@ -0,0 +1,27 @@ +import unittest +from pandas.testing import assert_frame_equal +from TestHelper import TestHelper +import pandas as pd +from CountryCountsByClickedBatchcodeProvider import CountryCountsByClickedBatchcodeProvider + +class CountryCountsByClickedBatchcodeProviderTest(unittest.TestCase): + + def test_mergeCountryCountsByBatchcodeTables(self): + # Given + + # When + countryCountsByClickedBatchcodeTable = CountryCountsByClickedBatchcodeProvider.getCountryCountsByClickedBatchcode('src/testdata/GoogleAnalytics/CountryByBatchcode 20230302-20230430.csv') + + # Then + assert_frame_equal( + countryCountsByClickedBatchcodeTable, + TestHelper.createDataFrame( + columns = ['COUNTRY_COUNT_BY_VAX_LOT'], + data = [ [1], + [10], + [5]], + index = pd.MultiIndex.from_tuples( + names = ['VAX_LOT', 'COUNTRY'], + tuples = [['#012M20A', 'United States'], + ['#EN6203', 'United States'], + ['000006A', 'Japan']]))) diff --git a/src/testdata/GoogleAnalytics/CountryByBatchcode 20230302-20230430.csv b/src/testdata/GoogleAnalytics/CountryByBatchcode 20230302-20230430.csv index 03f690d17ee..2d16c6834a2 100644 --- a/src/testdata/GoogleAnalytics/CountryByBatchcode 20230302-20230430.csv +++ b/src/testdata/GoogleAnalytics/CountryByBatchcode 20230302-20230430.csv @@ -4,3 +4,8 @@ # 20230302-20230430 # ---------------------------------------- +Clicked Batchcode,Country,Event count +,,15190,Grand total +#012M20A,United States,1 +#EN6203,United States,10 +000006A,Japan,5