def test_update_music(self): title = 'music_title' artist = 'music_artist' album = 'music_album' company = 'music_company' public_time = '2013' kbps = '64' uuid = 'douban-uuid' music = add_music(title, artist, album, company, public_time, kbps, self.cover, self.audio, uuid) self.cover.seek(0) self.audio.seek(0) music = get_music()[0] # exchange cover & audio update_music(music, title='new_title', artist='new_artist', album='new_album', company='new_company', public_time='2014', kbps='128', cover=self.audio, audio=self.cover, uuid='new_douban-uuid') music = get_music()[0] assert music.title == 'new_title' assert music.artist == 'new_artist' assert music.album == 'new_album' assert music.company == 'new_company' assert music.public_time == '2014' assert music.kbps == '128' self.cover.seek(0) self.audio.seek(0) assert music.cover.read() == self.audio.read() assert music.audio.read() == self.cover.read() assert music.uuid == 'new_douban-uuid'
def patch(self, key): args = MusicPatchArgs().args music = get_music(key=key)[0] update_music(music, **args) music = get_music(key=key)[0] return music