def test_sitemap(self): """Test for the sitemap.xml""" category(save=True) speaker(save=True) video(save=True) resp = self.client.get('/sitemap.xml') eq_(resp.status_code, 200)
def test_videos_by_category(self): cat1 = category(slug="pycon-us-2014", save=True) cat2 = category(slug="scipy-2013", save=True) video(state=Video.STATE_LIVE, title=u"Foo1", category=cat1, save=True) video(state=Video.STATE_LIVE, title=u"Foo2", category=cat1, save=True) video(state=Video.STATE_LIVE, title=u"Foo3", category=cat2, save=True) resp = self.auth_get("/api/v2/video/?category=pycon-us-2014", content_type="application/json") data = json.loads(smart_text(resp.content)) eq_(len(data["results"]), 2)
def test_post_video_with_urls(self): """Test that authenticated user can create videos.""" cat = category(save=True) person = speaker(save=True) tag1 = tag(save=True) tag2 = tag(save=True) lang = language(save=True) data = { "title": "Creating delicious APIs for Django apps since 2010.", "category": "/api/v1/category/%d/" % cat.pk, "speakers": ["/api/v1/speaker/%d/" % person.pk], "tags": ["/api/v1/tag/%d/" % tag1.pk, "/api/v1/tag/%d/" % tag2.pk], "language": lang.name, "state": Video.STATE_LIVE, } resp = self.auth_post("/api/v1/video/", json.dumps(data), content_type="application/json") eq_(resp.status_code, 201) # Get the created video resp = self.auth_get(resp["Location"], {"format": "json"}) eq_(resp.status_code, 200) eq_(json.loads(resp.content)["title"], data["title"]) # Verify the data vid = Video.objects.get(title=data["title"]) eq_(vid.title, data["title"]) eq_(list(vid.speakers.values_list("name", flat=True)), [person.name]) eq_(sorted(vid.tags.values_list("tag", flat=True)), sorted([tag1.tag, tag2.tag])) eq_(vid.language.name, lang.name)
def test_create_and_update_video(self): cat = category(save=True) lang = language(name=u'English', save=True) ret = richardapi.create_video( self.api_url, auth_token=self.token.key, video_data={ 'title': 'Test video', 'language': lang.name, 'category': cat.title, 'state': 2, # Has to be draft so update works 'speakers': ['Jimmy'], 'tags': ['foo'], }) video = Video.objects.get(title='Test video') eq_(video.title, ret['title']) eq_(video.state, ret['state']) eq_(video.id, ret['id']) ret['title'] = 'Video Test' ret = richardapi.update_video(self.api_url, auth_token=self.token.key, video_id=ret['id'], video_data=ret) video = Video.objects.get(title='Video Test') eq_(video.title, ret['title'])
def test_post_with_tag_name(self): """Test that you can post video with url tags or real tags""" cat = category(save=True) data = {'title': 'test1', 'category': '/api/v1/category/%d/' % cat.pk, 'state': Video.STATE_DRAFT} footag = u'footag' data.update( { 'title': 'test2', 'tags': [footag], }) resp = self.auth_post('/api/v1/video/', json.dumps(data), content_type='application/json') eq_(resp.status_code, 201) # Get the created video resp = self.auth_get(resp['Location'], {'format': 'json'}) # Verify the tag vid = Video.objects.get(title=data['title']) eq_(vid.tags.values_list('tag', flat=True)[0], footag)
def test_get_category(self): """Test that a category can be retrieved.""" cat = category(save=True) resp = self.client.get('/api/v1/category/%d/' % cat.pk, {'format': 'json'}) eq_(resp.status_code, 200) eq_(json.loads(resp.content)['name'], cat.name)
def test_post_video_with_urls(self): """Test that authenticated user can create videos.""" cat = category(save=True) person = speaker(save=True) tag1 = tag(save=True) tag2 = tag(save=True) lang = language(save=True) data = {'title': 'Creating delicious APIs for Django apps since 2010.', 'category': '/api/v1/category/%d/' % cat.pk, 'speakers': ['/api/v1/speaker/%d/' % person.pk], 'tags': ['/api/v1/tag/%d/' % tag1.pk, '/api/v1/tag/%d/' % tag2.pk], 'language': lang.name, 'state': Video.STATE_LIVE} resp = self.auth_post('/api/v1/video/', json.dumps(data), content_type='application/json') eq_(resp.status_code, 201) # Get the created video resp = self.auth_get(resp['Location'], {'format': 'json'}) eq_(resp.status_code, 200) eq_(json.loads(resp.content)['title'], data['title']) # Verify the data vid = Video.objects.get(title=data['title']) eq_(vid.title, data['title']) eq_(list(vid.speakers.values_list('name', flat=True)), [person.name]) eq_(sorted(vid.tags.values_list('tag', flat=True)), sorted([tag1.tag, tag2.tag])) eq_(vid.language.name, lang.name)
def test_create_and_update_video(self): cat = category(save=True) lang = language(name=u'English 2', save=True) ret = richardapi.create_video( self.api_url, auth_token=self.token.key, video_data={ 'title': 'Test video create and update', 'language': lang.name, 'category': cat.title, 'state': richardapi.STATE_DRAFT, 'speakers': ['Jimmy'], 'tags': ['foo'], }) video = Video.objects.get(title='Test video create and update') eq_(video.title, ret['title']) eq_(video.state, ret['state']) eq_(video.id, ret['id']) ret['title'] = 'Video Test' ret = richardapi.update_video( self.api_url, auth_token=self.token.key, video_id=ret['id'], video_data=ret ) video = Video.objects.get(title='Video Test') eq_(video.title, ret['title'])
def test_put(self): """Test that passing in an id, but no slug with a PUT works.""" cat = category(save=True) lang = language(save=True) vid = video(title='test1', save=True) data = {'id': vid.pk, 'title': vid.title, 'category': cat.title, 'language': lang.name, 'speakers': ['Guido'], 'tags': ['foo'], 'state': Video.STATE_DRAFT} resp = self.auth_put('/api/v2/video/%d/' % vid.pk, json.dumps(data), content_type='application/json') eq_(resp.status_code, 200) # Get the video from the db and compare data. vid = Video.objects.get(pk=vid.pk) eq_(vid.title, u'test1') eq_(vid.slug, u'test1') eq_(list(vid.speakers.values_list('name', flat=True)), ['Guido']) eq_(list(vid.tags.values_list('tag', flat=True)), ['foo'])
def test_put(self): """Test that passing in an id, but no slug with a PUT works.""" cat = category(save=True) lang = language(save=True) vid = video(title="test1", save=True) data = { "id": vid.pk, "title": vid.title, "category": cat.title, "language": lang.name, "speakers": ["Guido"], "tags": ["foo"], "state": Video.STATE_DRAFT, } resp = self.auth_put("/api/v2/video/%d/" % vid.pk, json.dumps(data), content_type="application/json") eq_(resp.status_code, 200) # Get the video from the db and compare data. vid = Video.objects.get(pk=vid.pk) eq_(vid.title, u"test1") eq_(vid.slug, u"test1") eq_(list(vid.speakers.values_list("name", flat=True)), ["Guido"]) eq_(list(vid.tags.values_list("tag", flat=True)), ["foo"])
def test_post_video_not_authenticated(self): """Test that not authenticated users can't write.""" cat = category(save=True) data = {"title": "Creating delicious APIs since 2010.", "category": cat.title, "state": Video.STATE_LIVE} resp = self.client.post("/api/v2/video/", json.dumps(data), content_type="application/json") eq_(resp.status_code, 401)
def test_get_category(self): """Test that a category can be retrieved.""" cat = category(save=True) resp = self.client.get("/api/v1/category/%d/" % cat.pk, {"format": "json"}) eq_(resp.status_code, 200) eq_(json.loads(resp.content)["name"], cat.name)
def test_post_video(self): """Test that authenticated user can create videos.""" cat = category(save=True) data = {'title': 'Creating delicious APIs for Django apps since 2010.', 'category': '/api/v1/category/%d/' % cat.pk, 'speakers': ['Guido'], 'tags': ['django', 'api'], 'state': Video.STATE_LIVE} resp = self.auth_post('/api/v1/video/', json.dumps(data), content_type='application/json') eq_(resp.status_code, 201) # Get the created video resp = self.auth_get(resp['Location'], {'format': 'json'}) eq_(resp.status_code, 200) eq_(json.loads(resp.content)['title'], data['title']) vid = Video.objects.get(title=data['title']) eq_(vid.title, data['title']) eq_(vid.slug, u'creating-delicious-apis-for-django-apps-since-201') eq_(list(vid.speakers.values_list('name', flat=True)), ['Guido']) eq_(sorted(vid.tags.values_list('tag', flat=True)), [u'api', u'django'])
def test_post_with_speaker_with_extra_spaces(self): """Test that you can post videos with speaker names""" cat = category(save=True) fooperson = u' Carl ' data = {'title': 'test1', 'category': '/api/v1/category/%d/' % cat.pk, 'state': Video.STATE_DRAFT} data.update( { 'title': 'test2', 'speakers': [fooperson], }) resp = self.auth_post('/api/v1/video/', json.dumps(data), content_type='application/json') print resp.content eq_(resp.status_code, 201) # Get the created video resp = self.auth_get(resp['Location'], {'format': 'json'}) # Verify the speaker vid = Video.objects.get(title=data['title']) eq_(vid.speakers.values_list('name', flat=True)[0], fooperson.strip())
def test_post_with_speaker_name(self): """Test that you can post videos with speaker names""" cat = category(save=True) fooperson = u'Carl' data = {'title': 'test1', 'category': '/api/v1/category/%d/' % cat.pk, 'state': Video.STATE_DRAFT} data.update( { 'title': 'test2', 'speakers': [fooperson], }) resp = self.auth_post('/api/v1/video/', json.dumps(data), content_type='application/json') print resp.content eq_(resp.status_code, 201) # Get the created video resp = self.auth_get(resp['Location'], {'format': 'json'}) # Verify the speaker vid = Video.objects.get(title=data['title']) eq_(vid.speakers.values_list('name', flat=True)[0], fooperson)
def test_post_with_category_title(self): """Test that a category title works""" cat = category(title="testcat", save=True) data = {"title": "test1", "category": cat.title, "state": Video.STATE_DRAFT} resp = self.auth_post("/api/v1/video/", json.dumps(data), content_type="application/json") eq_(resp.status_code, 201)
def test_get_category(self): """Test that a category can be retrieved.""" cat = category(save=True) resp = self.client.get('/api/v1/category/%d/' % cat.pk, {'format': 'json'}) eq_(resp.status_code, 200) eq_(json.loads(resp.content)['title'], cat.title)
def test_get_category(self): """Test that a category can be retrieved.""" cat = category(save=True) resp = self.client.get("/api/v2/category/%s/" % cat.slug, {"format": "json"}) eq_(resp.status_code, 200) content = json.loads(resp.content) eq_(json.loads(resp.content)["title"], cat.title)
def test_post_video_no_title(self): """Test that no title throws an error.""" cat = category(save=True) data = {"title": "", "category": cat.title, "state": Video.STATE_LIVE} resp = self.auth_post("/api/v2/video/", json.dumps(data), content_type="application/json") eq_(resp.status_code, 400)
def test_post_with_bad_state(self): """Test that a bad state is rejected""" cat = category(save=True) data = {"title": "test1", "category": cat.title, "state": 0} resp = self.auth_post("/api/v2/video/", json.dumps(data), content_type="application/json") eq_(resp.status_code, 400)
def test_post_with_bad_language(self): """Test that a bad state is rejected""" cat = category(title="testcat", save=True) data = {"title": "test1", "category": cat.title, "state": Video.STATE_DRAFT, "language": "lolcats"} resp = self.auth_post("/api/v2/video/", json.dumps(data), content_type="application/json") eq_(resp.status_code, 400)
def test_get_category(self): """Test that a category can be retrieved.""" cat = category(save=True) resp = self.client.get('/api/v2/category/%s/' % cat.slug, {'format': 'json'}) eq_(resp.status_code, 200) content = json.loads(smart_text(resp.content)) eq_(json.loads(smart_text(resp.content))['title'], cat.title)
def test_get_category(self): """Test that a category can be retrieved.""" cat = category(save=True) resp = self.client.get('/api/v2/category/%s/' % cat.slug, {'format': 'json'}) eq_(resp.status_code, 200) content = json.loads(smart_text(resp.content)) eq_(content['title'], cat.title)
def test_post_with_bad_speaker_string(self): cat = category(save=True) data = {"title": "test1", "category": "/api/v1/category/%d/" % cat.pk, "state": Video.STATE_DRAFT} data.update({"speakers": [""]}) resp = self.auth_post("/api/v1/video/", json.dumps(data), content_type="application/json") eq_(resp.status_code, 400)
def test_post_with_bad_tag_url(self): cat = category(save=True) data = {"title": "test1", "category": "/api/v1/category/%d/" % cat.pk, "state": Video.STATE_DRAFT} # Post video using /api/v1/tag/xx. data.update({"tags": ["/api/v1/tag/50/"]}) resp = self.auth_post("/api/v1/video/", json.dumps(data), content_type="application/json") eq_(resp.status_code, 404)
def test_post_video_not_authenticated(self): """Test that not authenticated users can't write.""" cat = category(save=True) data = {'title': 'Creating delicious APIs for Django apps since 2010.', 'category': '/api/v1/category/%d/' % cat.pk, 'state': Video.STATE_LIVE} resp = self.client.post('/api/v1/video/', json.dumps(data), content_type='application/json') eq_(resp.status_code, 401)
def test_post_video_not_authenticated(self): """Test that not authenticated users can't write.""" cat = category(save=True) data = {'title': 'Creating delicious APIs since 2010.', 'category': cat.title, 'state': Video.STATE_LIVE} resp = self.client.post('/api/v2/video/', json.dumps(data), content_type='application/json') eq_(resp.status_code, 401)
def test_post_with_category_title(self): """Test that a category title works""" cat = category(title='testcat', save=True) data = {'title': 'test1', 'category': cat.title, 'state': Video.STATE_DRAFT} resp = self.auth_post('/api/v1/video/', json.dumps(data), content_type='application/json') eq_(resp.status_code, 201)
def test_post_with_bad_state(self): """Test that a bad state is rejected""" cat = category(save=True) data = {'title': 'test1', 'category': cat.title, 'state': 0} resp = self.auth_post('/api/v2/video/', json.dumps(data), content_type='application/json') eq_(resp.status_code, 400)
def test_post_video_no_title(self): """Test that no title throws an error.""" cat = category(save=True) data = {'title': '', 'category': cat.title, 'state': Video.STATE_LIVE} resp = self.auth_post('/api/v2/video/', json.dumps(data), content_type='application/json') eq_(resp.status_code, 400)
def test_post_video_no_title(self): """Test that no title throws an error.""" cat = category(save=True) data = {'title': '', 'category': '/api/v1/category/%d/' % cat.pk, 'state': Video.STATE_LIVE} resp = self.auth_post('/api/v1/video/', json.dumps(data), content_type='application/json') eq_(resp.status_code, 400)
def test_post_with_bad_state(self): """Test that a bad state is rejected""" cat = category(save=True) data = {'title': 'test1', 'category': '/api/v1/category/%d/' % cat.pk, 'state': 0} resp = self.auth_post('/api/v1/video/', json.dumps(data), content_type='application/json') eq_(resp.status_code, 400)
def test_post_with_bad_language(self): """Test that a bad state is rejected""" cat = category(title='testcat', save=True) data = {'title': 'test1', 'category': cat.title, 'state': Video.STATE_DRAFT, 'language': 'lolcats'} resp = self.auth_post('/api/v2/video/', json.dumps(data), content_type='application/json') eq_(resp.status_code, 400)
def test_post_with_bad_language(self): """Test that a bad state is rejected""" cat = category(title='testcat', save=True) data = {'title': 'test1', 'category': '/api/v1/category/%d/' % cat.pk, 'state': Video.STATE_DRAFT, 'language': 'lolcats'} resp = self.auth_post('/api/v1/video/', json.dumps(data), content_type='application/json') eq_(resp.status_code, 400)
def test_post_with_used_slug(self): """Test that an already used slug kicks up a 400.""" cat = category(save=True) video(title='test1', slug='test1', save=True) data = {'title': 'test1', 'category': '/api/v1/category/%d/' % cat.pk, 'state': Video.STATE_DRAFT, 'slug': 'test1'} resp = self.auth_post('/api/v1/video/', json.dumps(data), content_type='application/json') eq_(resp.status_code, 400)
def test_put_with_slug_and_no_id(self): """Test that a slug but no id with a PUT fails.""" cat = category(save=True) v = video(title='test1', slug='test1', save=True) data = {'slug': v.slug, 'title': 'test1', 'category': '/api/v1/category/%d/' % cat.pk, 'state': Video.STATE_DRAFT} resp = self.auth_put('/api/v1/video/%d/' % v.pk, json.dumps(data), content_type='application/json') eq_(resp.status_code, 400)
def test_post_with_category_title(self): """Test that a category title works""" cat = category(title='testcat', save=True) lang = language(name='English', save=True) data = {'title': 'test1', 'language': lang.name, 'category': cat.title, 'state': Video.STATE_DRAFT, 'slug': 'foo'} resp = self.auth_post('/api/v2/video/', json.dumps(data), content_type='application/json') eq_(resp.status_code, 201)
def test_post_with_bad_tag_string(self): cat = category(save=True) data = {"title": "test1", "category": cat.title, "state": Video.STATE_DRAFT} data.update({"tags": [""]}) resp = self.auth_post("/api/v2/video/", json.dumps(data), content_type="application/json") eq_(resp.status_code, 400) data.update({"tags": ["/api/v2/tag/1"]}) resp = self.auth_post("/api/v2/video/", json.dumps(data), content_type="application/json") eq_(resp.status_code, 400)
def test_post_with_used_slug(self): """Test that already used slug creates second video with new slug.""" cat = category(save=True) lang = language(save=True) video(title='test1', slug='test1', save=True) data = {'title': 'test1', 'category': cat.title, 'language': lang.name, 'state': Video.STATE_DRAFT, 'slug': 'test1'} resp = self.auth_post('/api/v2/video/', json.dumps(data), content_type='application/json') eq_(resp.status_code, 201)
def test_category_urls(self): """Test the view of an category.""" cat = category(save=True) cases = [ cat.get_absolute_url(), u'/category/%s/%s/' % (cat.id, cat.slug), # with slug and / u'/category/%s/%s' % (cat.id, cat.slug), # with slug and no / u'/category/%s/' % cat.id, # no slug and / u'/category/%s' % cat.id, # no slug and no / ] for url in cases: resp = self.client.get(url) eq_(resp.status_code, 200) self.assertTemplateUsed(resp, 'videos/category.html')
def test_category_feed(self): """Tests for Category rss feed""" # Test that only categories with live videos are included. feed = CategoryFeed() cat = category(save=True) video(category=cat, save=True) v2 = video(category=cat, save=True) # No live videos, no category in feed eq_(len(feed.items()), 0) # At least one video is live, category is included v2.state = Video.STATE_LIVE v2.save() eq_([x.pk for x in feed.items()], [cat.pk]) # Category feed description_template exists. found_tpl = True try: get_template(feed.description_template) except TemplateDoesNotExist: found_tpl = False eq_(found_tpl, True) # Category list feeds is accessible. resp = self.client.get(reverse('videos-category-feed')) eq_(resp.status_code, 200) # Category videos feed is accessible. resp = self.client.get( reverse('videos-category-videos-feed', kwargs={ 'category_id': cat.id, 'slug': cat.slug })) eq_(resp.status_code, 200) # Category videos feed returns 404, invalid category_id. resp = self.client.get( reverse('videos-category-videos-feed', kwargs={ 'category_id': 50, 'slug': 'fake-slug' })) eq_(resp.status_code, 404)
def test_category_list_with_categories(self): """Test the view of the listing of all categories.""" category(save=True) category(save=True) category(save=True) url = reverse('videos-category-list') resp = self.client.get(url) eq_(resp.status_code, 200) self.assertTemplateUsed(resp, 'videos/category_list.html')
def test_get_category_list(self): """Test that a category can be retrieved.""" category(save=True) category(save=True) category(save=True) resp = self.client.get('/api/v2/category/', {'format': 'json'}) eq_(resp.status_code, 200) content = json.loads(smart_text(resp.content)) eq_(len(content['results']), 3)
def test_post_with_bad_tag_string(self): cat = category(save=True) data = {'title': 'test1', 'category': cat.title, 'state': Video.STATE_DRAFT} data.update({'tags': ['']}) resp = self.auth_post('/api/v2/video/', json.dumps(data), content_type='application/json') eq_(resp.status_code, 400) data.update({'tags': ['/api/v2/tag/1']}) resp = self.auth_post('/api/v2/video/', json.dumps(data), content_type='application/json') eq_(resp.status_code, 400)
def test_post_with_bad_speaker_string(self): cat = category(save=True) data = {'title': 'test1', 'category': '/api/v1/category/%d/' % cat.pk, 'state': Video.STATE_DRAFT} data.update({'speakers': ['']}) resp = self.auth_post('/api/v1/video/', json.dumps(data), content_type='application/json') eq_(resp.status_code, 400) data.update({'speakers': ['/api/v1/speaker/1']}) resp = self.auth_post('/api/v1/video/', json.dumps(data), content_type='application/json') eq_(resp.status_code, 400)
def test_create_and_get_video(self): cat = category(save=True) lang = language(name=u'English 1', save=True) ret = richardapi.create_video(self.api_url, auth_token=self.token.key, video_data={ 'title': 'Test video create and get', 'language': lang.name, 'category': cat.title, 'state': richardapi.STATE_DRAFT, 'speakers': ['Jimmy'], 'tags': ['foo'], }) vid = richardapi.get_video(self.api_url, auth_token=self.token.key, video_id=ret['id']) eq_(vid['id'], ret['id']) eq_(vid['title'], ret['title'])
def test_post_with_tag_name(self): """Test that you can post video with url tags or real tags""" cat = category(save=True) lang = language(save=True) footag = u'footag' data = { 'title': 'test1', 'category': cat.title, 'language': lang.name, 'state': Video.STATE_DRAFT, 'tags': [footag], } resp = self.auth_post('/api/v2/video/', json.dumps(data), content_type='application/json') eq_(resp.status_code, 201) # Verify the tag vid = Video.objects.get(title=data['title']) eq_(vid.tags.values_list('tag', flat=True)[0], footag)
def test_get_video_data(self): cat = category(title=u'Foo Title', save=True) vid = video(title=u'Foo Bar', category=cat, state=Video.STATE_LIVE, save=True) t = tag(tag=u'tag', save=True) vid.tags = [t] s = speaker(name=u'Jim', save=True) vid.speakers = [s] resp = self.client.get('/api/v1/video/%d/' % vid.pk, {'format': 'json'}) eq_(resp.status_code, 200) content = json.loads(resp.content) eq_(content['title'], vid.title) eq_(content['slug'], 'foo-bar') # This should be the category title--not api url eq_(content['category'], cat.title) # This should be the tag--not api url eq_(content['tags'], [t.tag]) # This should be the speaker name--not api url eq_(content['speakers'], [s.name])
def test_post_with_speaker_with_extra_spaces(self): """Test that you can post videos with speaker names""" cat = category(save=True) lang = language(save=True) fooperson = u' Carl ' data = { 'title': 'test1', 'category': cat.title, 'language': lang.name, 'state': Video.STATE_DRAFT, 'speakers': [fooperson], } resp = self.auth_post('/api/v2/video/', json.dumps(data), content_type='application/json') eq_(resp.status_code, 201) # Verify the speaker vid = Video.objects.get(title=data['title']) eq_(vid.speakers.values_list('name', flat=True)[0], fooperson.strip())
def test_post_video(self): """Test that authenticated user can create videos.""" cat = category(save=True) lang = language(name='English', save=True) data = {'title': 'Creating delicious APIs for Django apps since 2010.', 'language': lang.name, 'category': cat.title, 'speakers': ['Guido'], 'tags': ['django', 'api'], 'state': Video.STATE_LIVE} resp = self.auth_post('/api/v2/video/', json.dumps(data), content_type='application/json') eq_(resp.status_code, 201) eq_(json.loads(smart_text(resp.content))['title'], data['title']) vid = Video.objects.get(title=data['title']) eq_(vid.title, data['title']) eq_(vid.slug, u'creating-delicious-apis-for-django-apps-since-201') eq_(list(vid.speakers.values_list('name', flat=True)), ['Guido']) eq_(sorted(vid.tags.values_list('tag', flat=True)), [u'api', u'django'])
def test_put_fails_with_live_videos(self): """Test that passing in an id, but no slug with a PUT works.""" cat = category(save=True) lang = language(save=True) vid = video( title='test1', category=cat, language=lang, state=Video.STATE_LIVE, save=True) data = {'id': vid.pk, 'title': 'new title', 'category': cat.title, 'language': lang.name, 'speakers': ['Guido'], 'tags': ['foo'], 'state': Video.STATE_DRAFT} resp = self.auth_put('/api/v2/video/%d/' % vid.pk, json.dumps(data), content_type='application/json') eq_(resp.status_code, 403)
def test_get_category(self): cat = category(save=True) cat_from_api = richardapi.get_category(self.api_url, cat.title) eq_(cat_from_api['title'], cat.title)