def test_log_file_none_files(log_location_file): write_query_log('123', None, 0, timedelta(seconds=20), True, path_to_log_dir=log_location_file.parent) assert log_location_file.exists() t = log_location_file.read_text().split('\n')[1] assert t == '123,-1,0,20.0,1'
def test_log_file_write_minutes(log_location_file): write_query_log('123', 10, 0, timedelta(minutes=2), True, path_to_log_dir=log_location_file.parent) assert log_location_file.exists() t = log_location_file.read_text().split('\n')[1] assert t == '123,10,0,120.0,1'
def test_log_file_write_2lines(log_location_file): write_query_log('123', 10, 0, timedelta(minutes=2), True, path_to_log_dir=log_location_file.parent) write_query_log('124', 10, 0, timedelta(minutes=2), True, path_to_log_dir=log_location_file.parent) assert log_location_file.exists() t = log_location_file.read_text() assert len(t.split('\n')) == 4