Skip to content

Commit

Permalink
update test
Browse files Browse the repository at this point in the history
  • Loading branch information
altonalexander committed Feb 11, 2023
1 parent 7050b13 commit 1051408
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,10 @@ def query_table_clicks(start_date, end_date, PROJECT_ID, DATASET, TABLE, propert

days_to_check["total_clicks"] = days_to_check["total_clicks"].replace(np.nan, 0)
days_to_check = days_to_check[days_to_check['total_clicks']==0]


# loop over the days that are missing clicks
for index, row in days_to_check.iterrows():
for index, row in days_to_check.sort_values('start_date').iterrows():


start_date_to_process = row['start_date']
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@

from main import run
import datetime


def test_main():
'''Test main locally'''

# construct input variables
site = "bikelanes.com"
BQ_DATASET_NAME = 'data_winners_dataset'
BQ_TABLE_NAME = 'gsc_daily_table'

# if testing locally
from unittest.mock import Mock
data = {
'site': site,
'BQ_DATASET_NAME':BQ_DATASET_NAME,
'BQ_TABLE_NAME':BQ_TABLE_NAME,
'start_date': '2022-04-07',
'n_days_back':100
}
request = Mock(get_json=Mock(return_value=data), args=data)
res = run(request)

True

0 comments on commit 1051408

Please sign in to comment.