本文整理汇总了Python中playlists.models.PlaylistTrack.save方法的典型用法代码示例。如果您正苦于以下问题:Python PlaylistTrack.save方法的具体用法?Python PlaylistTrack.save怎么用?Python PlaylistTrack.save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类playlists.models.PlaylistTrack
的用法示例。
在下文中一共展示了PlaylistTrack.save方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: PlaylistTest
# 需要导入模块: from playlists.models import PlaylistTrack [as 别名]
# 或者: from playlists.models.PlaylistTrack import save [as 别名]
class PlaylistTest(APITest):
def setUp(self):
super(PlaylistTest, self).setUp()
dbconfig['lastfm.api_key'] = 'SEKRET_LASTFM_KEY'
self.dj = User(dj_name='DJ Night Moves', first_name='Steve',
last_name='Dolfin', email='[email protected]',
roles=[auth.roles.DJ])
self.dj.save()
self.playlist = ChirpBroadcast()
(self.stevie,
self.talking_book,
self.tracks) = create_stevie_wonder_album_data()
def play_stevie_song(self, song_name):
self.playlist_track = PlaylistTrack(
playlist=self.playlist,
selector=self.dj,
artist=self.stevie,
album=self.talking_book,
track=self.tracks[song_name],
notes='from 1972!',
freeform_label='Motown')
self.playlist_track.save()
return self.playlist_track
示例2: APITest
# 需要导入模块: from playlists.models import PlaylistTrack [as 别名]
# 或者: from playlists.models.PlaylistTrack import save [as 别名]
class APITest(unittest.TestCase):
def setUp(self):
dbconfig['lastfm.api_key'] = 'SEKRET_LASTFM_KEY'
self.client = TestApp(application)
self.dj = User(dj_name='DJ Night Moves', first_name='Steve',
last_name='Dolfin', email='[email protected]',
roles=[auth.roles.DJ])
self.dj.save()
self.playlist = ChirpBroadcast()
(self.stevie,
self.talking_book,
self.tracks) = create_stevie_wonder_album_data()
def tearDown(self):
assert memcache.flush_all()
clear_data()
def play_stevie_song(self, song_name):
self.playlist_track = PlaylistTrack(
playlist=self.playlist,
selector=self.dj,
artist=self.stevie,
album=self.talking_book,
track=self.tracks[song_name],
notes='from 1972!',
freeform_label='Motown')
self.playlist_track.save()
return self.playlist_track
def request(self, url):
r = self.client.get(url)
eq_(r.status, '200 OK')
eq_(r.headers['content-type'], 'application/json')
data = simplejson.loads(r.body)
return data