예제 #1
0
	def test_remove_playlist_bookmark_bad_request(self):
		user_steam_id, user_id = self._create_steam_user('user_name')
		video_id = db.add_twitch_video(
				'video_name', 99, 'archive_id', 'video_file_url', 'link_url')
		bookmark_id = db.add_video_bookmark(user_id, video_id, 'comment', 33)
		playlist_id = db.create_playlist(user_id, 'playlist_name', now=self.now)
		db.add_playlist_bookmark(user_id, playlist_id, bookmark_id, now=self.now)

		# Assert that the request fails with a missing client identifier.
		with app.test_client() as client:
			response = client.post('/remove_playlist_bookmark',
					data={'playlist_id': playlist_id, 'bookmark_id': bookmark_id})
			self._assert_not_authorized(response)

		# Assert that the request fails with a missing playlist identifier.
		with app.test_client() as client:
			self._add_client_id(client, user_id)
			response = client.post('/remove_playlist_bookmark', data={'bookmark_id': bookmark_id})
			self._assert_ajax_failure(response)

		# Assert that the request fails with a missing bookmark identifier.
		with app.test_client() as client:
			self._add_client_id(client, user_id)
			response = client.post('/remove_playlist_bookmark', data={'playlist_id': playlist_id})
			self._assert_ajax_failure(response)
예제 #2
0
	def test_remove_video_bookmark(self):
		user_steam_id, user_id = self._create_steam_user('user_name')
		video_id = db.add_twitch_video(
				'video_name', 99, 'archive_id', 'video_file_url', 'link_url')
		bookmark_id = db.add_video_bookmark(user_id, video_id, 'comment', 33)

		with app.test_client() as client:
			self._add_client_id(client, user_id)
			response = client.post('/remove_video_bookmark', data={'bookmark_id': bookmark_id})
			self._assert_ajax_success(response)
예제 #3
0
	def test_show_playlist(self):
		user_steam_id, user_id = self._create_steam_user('user_name')
		video_id = db.add_twitch_video(
				'video_name', 99, 'archive_id', 'video_file_url', 'link_url')
		bookmark_id = db.add_video_bookmark(user_id, video_id, 'comment', 33)
		playlist_id = db.create_playlist(user_id, 'playlist_name', now=self.now)
		db.add_playlist_bookmark(user_id, playlist_id, bookmark_id, now=self.now)

		# Get the playlist.
		with app.test_client() as client:
			response = client.get('/playlist/%s' % playlist_id)
			self.assertEqual(requests.codes.ok, response.status_code)
예제 #4
0
	def test_vote_bookmark_thumb_up_bad_request(self):
		user_steam_id, user_id = self._create_steam_user('user_name')
		video_id = db.add_twitch_video(
				'video_name', 99, 'archive_id', 'video_file_url', 'link_url')
		bookmark_id = db.add_video_bookmark(user_id, video_id, 'comment', 33)
		client_steam_id, client_id = self._create_steam_user('client_name')

		# Assert that the request fails with a missing client identifier.
		with app.test_client() as client:
			response = client.post('/vote_bookmark_thumb_up', data={'bookmark_id': bookmark_id})
			self._assert_not_authorized(response)

		# Assert that the request fails with a missing bookmark identifier.
		with app.test_client() as client:
			self._add_client_id(client, client_id)
			response = client.post('/vote_bookmark_thumb_up')
			self._assert_ajax_failure(response)