本文整理汇总了Python中playlists.models.PlaylistTrack.delete方法的典型用法代码示例。如果您正苦于以下问题:Python PlaylistTrack.delete方法的具体用法?Python PlaylistTrack.delete怎么用?Python PlaylistTrack.delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类playlists.models.PlaylistTrack
的用法示例。
在下文中一共展示了PlaylistTrack.delete方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TestLive365PlaylistTasks
# 需要导入模块: from playlists.models import PlaylistTrack [as 别名]
# 或者: from playlists.models.PlaylistTrack import delete [as 别名]
#.........这里部分代码省略.........
.returns("<service response>"))
with fudge.patched_context(playlists.tasks.urllib2, "urlopen", fake_urlopen):
resp = self.client.post(reverse('playlists.send_track_to_live365'), {
'id': self.track.key()
})
fudge.verify()
def test_create_latin_chars(self):
self.playlist = ChirpBroadcast()
selector = self.get_selector()
self.track = PlaylistTrack(
playlist=self.playlist,
selector=selector,
freeform_artist_name=u'Bj\xf6rk',
freeform_album_title=u'Bj\xf6rk album',
freeform_track_title=u'Bj\xf6rk song')
self.track.put()
def inspect_request(r):
# NOTE: due to URL fetching, you can only raise
# AssertionError here
self.assertEqual(r.get_full_url(), 'http://__dummylive365service__/cgi-bin/add_song.cgi')
qs = dict(cgi.parse_qsl(r.data))
self.assertEqual(qs['member_name'], "dummy_member")
self.assertEqual(qs['password'], "dummy_password")
self.assertEqual(qs['seconds'], '30')
# c should be replaced because latin-1 can't encode that and Live365 likes latin-1
self.assertEqual(qs['title'], 'Bj\xf6rk song')
self.assertEqual(qs['album'], 'Bj\xf6rk album')
self.assertEqual(qs['artist'], 'Bj\xf6rk')
return True
fake_urlopen = (fudge.Fake('urlopen', expect_call=True)
.with_args(arg.passes_test(inspect_request)))
fake_response = (fake_urlopen
.returns_fake()
.has_attr(code='200')
.provides('read')
.returns("<service response>"))
with fudge.patched_context(playlists.tasks.urllib2, "urlopen", fake_urlopen):
resp = self.client.post(reverse('playlists.send_track_to_live365'), {
'id': self.track.key()
})
fudge.verify()
def test_create_ascii_chars(self):
self.playlist = ChirpBroadcast()
selector = self.get_selector()
self.track = PlaylistTrack(
playlist=self.playlist,
selector=selector,
freeform_artist_name=u'artist',
freeform_album_title=u'album',
freeform_track_title=u'song')
self.track.put()
def inspect_request(r):
# NOTE: due to URL fetching, you can only raise
# AssertionError here
self.assertEqual(r.get_full_url(), 'http://__dummylive365service__/cgi-bin/add_song.cgi')
qs = dict(cgi.parse_qsl(r.data))
self.assertEqual(qs['member_name'], "dummy_member")
self.assertEqual(qs['password'], "dummy_password")
self.assertEqual(qs['seconds'], '30')
# c should be replaced because latin-1 can't encode that and Live365 likes latin-1
self.assertEqual(qs['title'], 'song')
self.assertEqual(qs['album'], 'album')
self.assertEqual(qs['artist'], 'artist')
return True
fake_urlopen = (fudge.Fake('urlopen', expect_call=True)
.with_args(arg.passes_test(inspect_request)))
fake_response = (fake_urlopen
.returns_fake()
.has_attr(code='200')
.provides('read')
.returns("<service response>"))
with fudge.patched_context(playlists.tasks.urllib2, "urlopen", fake_urlopen):
resp = self.client.post(reverse('playlists.send_track_to_live365'), {
'id': self.track.key()
})
fudge.verify()
def test_create_non_existant_track(self):
key = self.track.key()
self.track.delete() # make it non-existant
resp = self.client.post(reverse('playlists.send_track_to_live365'), {
'id': key
})
self.assertEqual(resp.status_code, 200)