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

Testing: getting repos - mocking GitHub with nock #52

Merged
merged 1 commit into from
Aug 21, 2015

Conversation

saraf
Copy link
Contributor

@saraf saraf commented Aug 21, 2015

Simulate a case where a user Strider Tester is registered
with github and has admin access to TWO repositories
one which belongs to him (stridertester/proj1) and one that
belongs to a team Strider Testers Union (stridertestersunion/union-proj-1)

getRepos should return an array containing the two repositories.
we are using actual responses received from github.com - as recorded
and mocked by nock to simulate.

@saraf saraf force-pushed the nocktest branch 2 times, most recently from 8a4ad9b to 0e65247 Compare August 21, 2015 02:50
// stridertester/proj1

//This file sets up mock responses as received from github for each request fired
//during the get repositories operation
Copy link
Member

Choose a reason for hiding this comment

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

Tip: For comment blocks this big (> 2 lines) /**/ should be used.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok! Will fix.

On Friday, August 21, 2015, Ilya Radchenko notifications@github.com wrote:

In test/mocks/setup_nock_repos.js
#52 (comment)
:

@@ -0,0 +1,325 @@
+var nock = require('nock');
+
+//Set up the mocks for getting a list of repositories for the stridertest user
+//The stridertest user is an admin of two organizations
+// stridertestersunion and
+// stridertesters1
+//and has two repositories to which he has admin access
+// stridertestersunion/union-proj-1
+// stridertester/proj1
+
+//This file sets up mock responses as received from github for each request fired
+//during the get repositories operation

Tip: For comment blocks this big (> 2 lines) /**/ should be used.


Reply to this email directly or view it on GitHub
https://github.com/Strider-CD/strider-github/pull/52/files#r37629025.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done.

Simulate a case where a user Strider Tester is registered
with github and has admin access to TWO repositories
one which belongs to him (stridertester/proj1) and one that
belongs to a team Strider Testers Union (stridertestersunion/union-proj-1)

getRepos should return an array containing the two repositories.
we are using actual responses received from github.com - as recorded
and mocked by nock to simulate.

This test was failing and we were getting three repositories.
This is because when getting the repos for the user, we also get
all the repos that he has access to from the teams of which he is a
member.

Also this was from the fix I intended to check in for
Strider-CD/strider#846

xdissent has already checked in the fix,
I have changed the comment to explain why a de-dupe is really needed.
knownasilya pushed a commit that referenced this pull request Aug 21, 2015
Testing:  getting repos - mocking GitHub with nock
@knownasilya knownasilya merged commit d81d53f into Strider-CD:master Aug 21, 2015
@knownasilya
Copy link
Member

Anyone know how to access this github user? Need to login to update the access token.

@saraf
Copy link
Contributor Author

saraf commented Aug 10, 2018 via email

@knownasilya
Copy link
Member

Got it, thanks!

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