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

Adds tests for search api methods responses Fixes #1418 #1437

Conversation

mlendale
Copy link

@mlendale mlendale commented May 26, 2017

Fixes #1418


This change is Reviewable

@PublicLabBot
Copy link

2 Messages
📖 @mlendale Thank you for your pull request! I’m here to help with some tips and recommendations. Please take a look at the list provided and help us review and accept your contribution!
📖 This pull request doesn’t link to a issue number. Please refer to the issue it fixes (if any) in the body of your PR, in the format: Fixes #123.

Generated by 🚫 Danger

@mlendale mlendale changed the title WIP tests search api methods responses WIP adds tests for search api methods responses May 26, 2017
@mlendale mlendale changed the title WIP adds tests for search api methods responses Adds tests for search api methods responses Fixes #1418 May 30, 2017
Copy link
Member

@jywarren jywarren left a comment

Choose a reason for hiding this comment

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

Thanks for your contribution and sorry for responding a little slow! We're very grateful for your work -- just a few requests before it's quite ready to merge in. Happy to help you through these steps!


matcher = JsonExpressions::Matcher.new(pattern)

json = JSON.parse(last_response.body)
Copy link
Member

Choose a reason for hiding this comment

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

Hi, here, we'd want to search for a profile, not "Blog" - so we could change get '/api/srch/profiles?srchString=Blog' to get '/api/srch/profiles?srchString=Bob' (working from the test data in /test/fixtures/users.yml`).

Then, as done above on these lines, we can test the returned data. In this case, we'd want to check that the returned data is the record for "Bob". We could make an educated guess but maybe the best would be to start by inserting a logging action to see what the contents are:

puts json['items'][0]

Once we know exactly what it returns, we can adjust the test to confirm that. Does this make sense?

@@ -1,31 +1,31 @@
GEM
remote: https://rubygems.org/
specs:
actionmailer (3.2.22.4)
actionpack (= 3.2.22.4)
actionmailer (3.2.22.5)
Copy link
Member

Choose a reason for hiding this comment

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

So, here, we don't really want to submit a new Gemfile.lock -- do you think you could remove that file from the commit using this guide? https://stackoverflow.com/questions/215718/reset-or-revert-a-specific-file-to-a-specific-revision-using-git

@david-days
Copy link
Collaborator

david-days commented Jun 3, 2017

@jywarren, This kind of work could fall under the planning issue I just put in to day, Issue #1449 if you want an overarching guide to this kind of work.

@mlendale, if you enjoy the work on the RESTful services and @jywarren agrees, I'd like to invite you to keep adding more work under Issue #1449.

For Phase 1, I'm adding the Swagger UI to the plots2 code as an initial documentation, testing, and learning tool. Then it's more of the work you've done here.

@jywarren
Copy link
Member

Hi, just a check in if you could use any help with this one!

@mlendale
Copy link
Author

mlendale commented Jun 12, 2017 via email

@jywarren
Copy link
Member

jywarren commented Jun 13, 2017 via email

# Expected search pattern
pattern = {
srchParams: {
srchString: 'Blog',
Copy link
Member

Choose a reason for hiding this comment

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

And here, there's probably not a question with the search string "Blog" -- but check the fixtures data in /test/fixtures/nodes.yml and see what search term would be appropriate for a questions search. Thanks!

# Expected search pattern
pattern = {
srchParams: {
srchString: 'Blog',
Copy link
Member

Choose a reason for hiding this comment

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

And here, check out /test/fixtures/tags.yml for a tag to search for, so that it returns at least one result.

@jywarren
Copy link
Member

Hi! I think I'm going to close this one up as we haven't heard back -- but we're still very interested in helping you get involved if you'd like! We have a new welcoming page and a whole lot of good issues up for grabs -- and ready to offer guidance if you need it. Thank you!!

https://publiclab.github.io/community-toolbox/#r=all

@jywarren jywarren closed this Jan 25, 2018
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.

None yet

4 participants