def test_create_tags_list_sorts_tags(): data = _get_resource_json('image_data_unsorted_tags.json') actual_tags_list = flickr._create_tags_list(data) expect_tags_list = ['tag1', 'tag2', 'tag3'] assert len(actual_tags_list) == len(expect_tags_list) assert all( [element in actual_tags_list for element in expect_tags_list] )
def test_create_tags_list_truncates_long_tags(): data = _get_resource_json('image_data_long_tags_string.json') actual_tags_list = flickr._create_tags_list(data, max_tag_string_length=37) expect_tags_list = ['tag1', 'tag2', 'tag3', 'tag4', 'tag5', 'tag6'] assert len(actual_tags_list) == len(expect_tags_list) assert all( [element in actual_tags_list for element in expect_tags_list] )
def test_create_tags_list_makes_tags_list(): data = _get_resource_json('image_data_varying_tags_whitespace.json') actual_tags_list = flickr._create_tags_list(data) expect_tags_list = ['tag1', 'tag2', 'tag3'] assert len(actual_tags_list) == len(expect_tags_list) assert all( [element in actual_tags_list for element in expect_tags_list] )
def test_create_tags_list_returns_falsy_empty_tags(): data = {'id': 'aslkjb', 'tags': ''} tags_list = flickr._create_tags_list(data) assert not tags_list
def test_create_tags_list_returns_falsy_no_tag_key(): data = {'id': 'aslkjb'} tags_list = flickr._create_tags_list(data) assert not tags_list