def test_construct_match_array_from_to_time(self): answer = [{ 'actions.time': { '$gte': '2017-10-17T21:37:28-06:00' } }, { 'actions.time': { '$lte': '2018-10-17T21:37:28-06:00' } }] result = LogService._construct_match_array( None, '2017-10-17T21:37:28-06:00', '2018-10-17T21:37:28-06:00', None) assert result is not None assert result == answer
def test_construct_all_match_fields_not_None(self): answer = [{ 'userId': '12345' }, { 'actions.time': { '$gte': '2017-10-17T21:37:28-06:00' } }, { 'actions.time': { '$lte': '2018-10-17T21:37:28-06:00' } }, { 'actions.type': { '$in': ['CLICK', 'VIEW', 'NAVIGATE'] } }] result = LogService._construct_match_array( '12345', '2017-10-17T21:37:28-06:00', '2018-10-17T21:37:28-06:00', ['CLICK', 'VIEW', 'NAVIGATE']) assert result is not None assert result == answer
def test_construct_match_types(self): answer = [{'actions.type': {'$in': ['CLICK', 'VIEW', 'NAVIGATE']}}] result = LogService._construct_match_array( None, None, None, ['CLICK', 'VIEW', 'NAVIGATE']) assert result is not None assert result == answer
def test_construct_match_array_userId(self): answer = [{'userId': '12345'}] result = LogService._construct_match_array('12345', None, None, None) assert result is not None assert result == answer
def test_construct_match_array_empty(self): result = LogService._construct_match_array(None, None, None, None) assert result is not None assert len(result) == 0