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

Issues API unit tests #116

Merged
merged 3 commits into from May 8, 2017
Merged

Issues API unit tests #116

merged 3 commits into from May 8, 2017

Conversation

BenFradet
Copy link
Contributor

Still need to add test cases to ApiSpec

@BenFradet
Copy link
Contributor Author

The command "sbt ++$TRAVIS_SCALA_VERSION test:fastOptJS" exited with 126.
0.00s$ sbt ++$TRAVIS_SCALA_VERSION orgScriptCI
/home/travis/.travis/job_stages: line 724: /usr/local/bin/sbt: Permission denied

@fedefernandez
Copy link
Contributor

I'm not sure what could be the cause. I'll try to take a look tomorrow.

@juanpedromoreno
Copy link
Member

@BenFradet @fedefernandez This might solve the issues: #117

@codecov-io
Copy link

codecov-io commented May 4, 2017

Codecov Report

Merging #116 into master will increase coverage by 0.77%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #116      +/-   ##
==========================================
+ Coverage    87.4%   88.17%   +0.77%     
==========================================
  Files          36       36              
  Lines         516      516              
  Branches        3        3              
==========================================
+ Hits          451      455       +4     
+ Misses         65       61       -4
Impacted Files Coverage Δ
...4s/shared/src/main/scala/github4s/GithubAPIs.scala 100% <0%> (+3.22%) ⬆️
...4s/shared/src/main/scala/github4s/api/Issues.scala 100% <0%> (+30%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c38ee4d...b09a98f. Read the comment docs.

@BenFradet
Copy link
Contributor Author

I still have a few unit tests failing, still investigating why

request
.withMethod("GET")
.withPath(s"/search/issues")
.withQueryStringParameters(new Parameter("q", s"$nonExistentSearchQuery+"))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

have you guys tried withQueryStringParameters before?
Never seems to match.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed it with regex 👍

Copy link
Contributor

Choose a reason for hiding this comment

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

👍

response should be('left)
}

"Issues >> Edit" should "return the edited issue if valid data is provided" ignore {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

for some reason this one's failing too

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You guys seem to have used post for patch request for the git data API: https://github.com/47deg/github4s/blob/master/github4s/jvm/src/test/scala/github4s/utils/MockGithubApiServer.scala#L328-L348.

So I'm assuming there is something wrong with how mock server deals with patch?

Copy link
Contributor

Choose a reason for hiding this comment

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

We should create an issue to fix that part. The root of the problem is the call to postData. In that part the request already has set the PATCH method but if we take a look to this method in scalaj-http we can see that it's setting the method to POST.

One solution could be to replace the postData call by:

-- .postData(body)
++ .postData(d).method(rb.httpVerb.verb)

But I've not tested it yet. Sorry about the confusion

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I get it, thanks. I'll log an issue 👍

@BenFradet BenFradet changed the title [wip] Issues API unit tests Issues API unit tests May 6, 2017
@BenFradet
Copy link
Contributor Author

Good to review 👍

Copy link
Contributor

@fedefernandez fedefernandez left a comment

Choose a reason for hiding this comment

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

This is great, thanks for your effort. I've left some minor comments, I don't understand why the tests in ApiSpec are passing so I appreciate some clarifications around that. Other than that, looks good to me!

.when(
request
.withMethod("POST")
.withPath(s"/repos/$validRepoOwner/$validRepoName/issues")
Copy link
Contributor

Choose a reason for hiding this comment

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

Should it be invalidRepoName?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

true, I don't know how the tests manage to pass 😕

mockServer
.when(
request
.withMethod("PATCH")
Copy link
Contributor

Choose a reason for hiding this comment

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

I think that our http client is applying a POST method for this operation

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yup I modified those, the sync doesn't seem to be reflected on gh, weird as well.

request
.withMethod("GET")
.withPath(s"/search/issues")
.withQueryStringParameters(new Parameter("q", s"$nonExistentSearchQuery+"))
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

Copy link
Contributor Author

@BenFradet BenFradet left a comment

Choose a reason for hiding this comment

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

I don't know what's going on with GH but the sync isn't reflected here.

.when(
request
.withMethod("POST")
.withPath(s"/repos/$validRepoOwner/$validRepoName/issues")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

true, I don't know how the tests manage to pass 😕

mockServer
.when(
request
.withMethod("PATCH")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yup I modified those, the sync doesn't seem to be reflected on gh, weird as well.

@BenFradet
Copy link
Contributor Author

nvm, pushed to my remote :'(

@BenFradet
Copy link
Contributor Author

The command "sbt ++$TRAVIS_SCALA_VERSION orgScriptCI" exited with 137.

on 2.12

@fedefernandez
Copy link
Contributor

/home/travis/.travis/job_stages: line 738: 5784 Killed
😞 retry?

@juanpedromoreno juanpedromoreno merged commit af46078 into master May 8, 2017
@juanpedromoreno juanpedromoreno deleted the issue_tests branch May 8, 2017 07:54
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