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


Python PlaylistTrack.established方法代码示例

本文整理汇总了Python中playlists.models.PlaylistTrack.established方法的典型用法代码示例。如果您正苦于以下问题:Python PlaylistTrack.established方法的具体用法?Python PlaylistTrack.established怎么用?Python PlaylistTrack.established使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在playlists.models.PlaylistTrack的用法示例。


在下文中一共展示了PlaylistTrack.established方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_view_shows_3_hours_of_tracks

# 需要导入模块: from playlists.models import PlaylistTrack [as 别名]
# 或者: from playlists.models.PlaylistTrack import established [as 别名]
    def test_view_shows_3_hours_of_tracks(self):
        selector = self.get_selector()
        playlist = ChirpBroadcast()
        track = PlaylistTrack(
                    playlist=playlist,
                    selector=selector,
                    freeform_artist_name="Steely Dan",
                    freeform_album_title="Aja",
                    freeform_track_title="Peg")
        track.put()
        # sleep to workaround microtime issues in Windows App Engine SDK
        time.sleep(0.4)
        track = PlaylistTrack(
                    playlist=playlist,
                    selector=selector,
                    freeform_artist_name="Def Leoppard",
                    freeform_album_title="Pyromania",
                    freeform_track_title="Photograph")
        track.put()
        time.sleep(0.4)
        track = PlaylistTrack(
                    playlist=playlist,
                    selector=selector,
                    freeform_artist_name="Freestyle Fellowship",
                    freeform_album_title="To Whom It May Concern",
                    freeform_track_title="Five O'Clock Follies")
        # older than 3 hours:
        track.established = datetime.datetime.now() - datetime.timedelta(hours=3, minutes=2)
        track.put()

        resp = self.client.get(reverse('playlists_landing_page'))
        context = resp.context[0]
        tracks = [t for t in context['playlist_events']]
        self.assertEquals(tracks[0].track_title, "Photograph")
        self.assertEquals(tracks[1].track_title, "Peg")
        self.assertEquals(len(tracks), 2, "tracks older than 3 hours were not hidden")
开发者ID:CDMirel,项目名称:chirpradio,代码行数:38,代码来源:test_views.py


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