def test_returns_empty_list_if_no_such_tag_exists(self): tag = Tag('cat') table = Mock() table.get_item.side_effect = DynamoDBKeyNotFoundError('no such tag') tag._stored_table = table eq_(tag.get_filenames(), [])
def test_get_filenames(self): item = MagicMock() item.__getitem__.return_value = '["BADCAFE", "DEADBEEF"]' table = Mock() table.get_item.return_value = item tag = Tag('cat') tag._stored_table = table filenames = tag.get_filenames() eq_(filenames, ['BADCAFE', 'DEADBEEF']) table.get_item.assert_called_with('cat')