当前位置: 首页>>代码示例>>Python>>正文


Python PlaylistTrack.save方法代码示例

本文整理汇总了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
开发者ID:BubbleTouchSoftware,项目名称:chirpradio,代码行数:27,代码来源:tests.py

示例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
开发者ID:kumar303,项目名称:chirpradio,代码行数:38,代码来源:tests.py


注:本文中的playlists.models.PlaylistTrack.save方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。