Skip to content

Add API endpoints for adding, removing and updating talk URLs#316

Merged
hodgestar merged 23 commits into
masterfrom
feature/add-talk-subobjects-to-api
Oct 10, 2016
Merged

Add API endpoints for adding, removing and updating talk URLs#316
hodgestar merged 23 commits into
masterfrom
feature/add-talk-subobjects-to-api

Conversation

@hodgestar
Copy link
Copy Markdown
Member

This adds the following API end points:

  • /talks/api/talks/<talk_id>/urls/
  • GET - list the URLs associated with a talk.
  • POST - add a URL to a talk.
  • /talks/api/talks/<talk_id>/urls/<url_id>/
  • GET - retrieve the URL
  • PUT - overwrite the URL
  • PATCH - update the URL
  • DELETE - delete the URL

If also adds a summary of the URLs to the data returned when querying the talks API.

@hodgestar
Copy link
Copy Markdown
Member Author

Ready for review.

Copy link
Copy Markdown
Member

@drnlm drnlm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple of notes, but otherwise looks good.

Comment thread wafer/talks/tests/test_views.py Outdated
talk_a = create_talk("Talk A", ACCEPTED, "author_a")
talk_b = create_talk("Talk B", REJECTED, "author_b")
response = self.client.get('/talks/api/talks/')
result_0, result_1 = response.data['results']
Copy link
Copy Markdown
Member

@drnlm drnlm Oct 9, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we splitting this if we're then testing response.data['results'] directly?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've removed these unused variables. :)

Comment thread wafer/talks/tests/test_views.py Outdated
url_b = TalkUrl.objects.create(
talk=talk, url="http://b.example.com/", description="slides")
response = self.client.get('/talks/api/talks/%d/urls/' % talk.talk_id)
result_0, result_1 = response.data['results']
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same question as before

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And these ones.

Comment thread wafer/talks/tests/test_views.py Outdated
def generic(self, *args, **kw):
response = super(SortedResultsClient, self).generic(*args, **kw)
return self._sorted_response(response)

Copy link
Copy Markdown
Member

@drnlm drnlm Oct 9, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't terrible specific to talks - should we move it to a test_utils module so it can be used when testing other apis?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I moved it into wafer.tests.api_utils. It'll likely need to grow some features once we start writing tests for other parts of the API.

Copy link
Copy Markdown
Member

@drnlm drnlm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@hodgestar hodgestar merged commit bc06791 into master Oct 10, 2016
@hodgestar hodgestar deleted the feature/add-talk-subobjects-to-api branch October 10, 2016 05:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants