Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 23 commits into from Oct 10, 2016

Conversation

Projects
None yet
2 participants
@hodgestar
Copy link
Member

commented Oct 9, 2016

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

This comment has been minimized.

Copy link
Member Author

commented Oct 9, 2016

Ready for review.

@drnlm
Copy link
Member

left a comment

A couple of notes, but otherwise looks good.

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']

This comment has been minimized.

Copy link
@drnlm

drnlm Oct 9, 2016

Member

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

This comment has been minimized.

Copy link
@hodgestar

hodgestar Oct 9, 2016

Author Member

I've removed these unused variables. :)

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']

This comment has been minimized.

Copy link
@drnlm

drnlm Oct 9, 2016

Member

Same question as before

This comment has been minimized.

Copy link
@hodgestar

hodgestar Oct 9, 2016

Author Member

And these ones.


def generic(self, *args, **kw):
response = super(SortedResultsClient, self).generic(*args, **kw)
return self._sorted_response(response)

This comment has been minimized.

Copy link
@drnlm

drnlm Oct 9, 2016

Member

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?

This comment has been minimized.

Copy link
@hodgestar

hodgestar Oct 9, 2016

Author Member

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.

@drnlm

drnlm approved these changes Oct 9, 2016

Copy link
Member

left a comment

👍

@hodgestar hodgestar merged commit bc06791 into master Oct 10, 2016

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details

@hodgestar hodgestar deleted the feature/add-talk-subobjects-to-api branch Oct 10, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.