Skip to content

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

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

Merged
merged 23 commits into from
Oct 10, 2016

Conversation

hodgestar
Copy link
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
Member Author

Ready for review.

Copy link
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.

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
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
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. :)

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
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
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.


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

Copy link
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
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
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