def test_construct_filter_array_from_to_time(self): answer = [{ '$gte': ['$$action.time', '2017-10-18T21:37:28-06:00'] }, { '$lte': ['$$action.time', '2018-10-18T21:37:28-06:00'] }] result = LogService._construct_filter_array( '2017-10-18T21:37:28-06:00', '2018-10-18T21:37:28-06:00', None) assert result is not None assert result == answer
def test_construct_all_filter_fields_not_None(self): answer = [{ '$gte': ['$$action.time', '2017-10-18T21:37:28-06:00'] }, { '$lte': ['$$action.time', '2018-10-18T21:37:28-06:00'] }, { '$in': ['$$action.type', ['CLICK', 'VIEW', 'NAVIGATE']] }] result = LogService._construct_filter_array( '2017-10-18T21:37:28-06:00', '2018-10-18T21:37:28-06:00', ['CLICK', 'VIEW', 'NAVIGATE']) assert result is not None assert result == answer
def test_construct_filter_array_from_to_time(self): answer = [{'$in': ['$$action.type', ['CLICK', 'VIEW']]}] result = LogService._construct_filter_array(None, None, ['CLICK', 'VIEW']) assert result is not None assert result == answer
def test_construct_filter_array_empty(self): result = LogService._construct_filter_array(None, None, None) assert result is not None assert len(result) == 0