def test_str_(self): """Test the __str__ method""" content_dict = {"title": "fake title"} item = data_structures.MusicServiceItem("fake_id", "desc", "ressources", "uri", content_dict) assert item.__str__() == '<MusicServiceItem title="fake title">'
def test_str_(self): """Test the __str__ method""" content_dict = {'title': 'fake title'} item = data_structures.MusicServiceItem('fake_id', 'desc', 'ressources', 'uri', content_dict) assert item.__str__() == '<MusicServiceItem title="fake title">'
def test_to_element(self, didl_item_to_element): """Test the to_element method""" didl_item_to_element.return_value = object() content_dict = {"title": "fake title"} item = data_structures.MusicServiceItem("fake_id", "desc", "ressources", "uri", content_dict) assert item.to_element() == didl_item_to_element.return_value
def test_to_element(self, didl_item_to_element): """Test the to_element method""" didl_item_to_element.return_value = object() content_dict = {'title': 'fake title'} item = data_structures.MusicServiceItem('fake_id', 'desc', 'ressources', 'uri', content_dict) assert item.to_element() == didl_item_to_element.return_value
def test_init(self, metadata_dict_base_init): """Test the __init__ method""" kwargs = { 'item_id': 'some_item_id', 'desc': 'the_desc', 'resources': 'the ressources', 'uri': 'https://the_uri', 'metadata_dict': {'some': 'dict'}, 'music_service': 'the music service', } music_service_item = data_structures.MusicServiceItem(**kwargs) # Test call to super class init metadata_dict_base_init.assert_called_once_with({'some': 'dict'}) # Test that all but the metadata_dict arg have been set as # attributes with the same names as the arguments kwargs.pop('metadata_dict') for arg_name, arg_value in kwargs.items(): assert getattr(music_service_item, arg_name) == arg_value
def test_init(self, metadata_dict_base_init): """Test the __init__ method""" kwargs = { "item_id": "some_item_id", "desc": "the_desc", "resources": "the ressources", "uri": "https://the_uri", "metadata_dict": {"some": "dict"}, "music_service": "the music service", } music_service_item = data_structures.MusicServiceItem(**kwargs) # Test call to super class init metadata_dict_base_init.assert_called_once_with({"some": "dict"}) # Test that all but the metadata_dict arg have been set as # attributes with the same names as the arguments kwargs.pop("metadata_dict") for arg_name, arg_value in kwargs.items(): assert getattr(music_service_item, arg_name) == arg_value