Skip to content

Commit

Permalink
test: adapt for removal of unauthenticated request fixtures
Browse files Browse the repository at this point in the history
  • Loading branch information
gr2m committed Dec 29, 2018
1 parent 75586f0 commit 2e1a4ed
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion test/end-to-end/smoke-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ URL=`echo $FIXTURES | grep -o '"url":\s*"[^"]*' | sed -E 's/"url":\s*"([^"]+)/\1

# send request using id & url, test if output contains expected string
# If it does not return exit code accordingly
curl -H"Accept: application/vnd.github.v3+json" $URL/repos/octokit-fixture-org/hello-world | grep -q '"full_name":"octokit-fixture-org/hello-world"'
curl -H"Accept: application/vnd.github.v3+json" -H"Authorization: token 0000000000000000000000000000000000000001" $URL/repos/octokit-fixture-org/hello-world | grep -q '"full_name":"octokit-fixture-org/hello-world"'
returnCode=$? # is 1 if grep could not find string above

# kill server and exit with exit code from above test
Expand Down
6 changes: 4 additions & 2 deletions test/integration/binary-response-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ test('binary response (octokit/rest.js#743)', async t => {
const getArchiveResponse = await agent
.get(`/api.github.com/${fixtureId}/repos/octokit-fixture-org/get-archive/tarball/master`)
.set({
accept: 'application/vnd.github.v3+json'
accept: 'application/vnd.github.v3+json',
authorization: 'token 0000000000000000000000000000000000000001'
})

t.is(getArchiveResponse.status, 302)
Expand All @@ -36,7 +37,8 @@ test('binary response (octokit/rest.js#743)', async t => {
const { status } = await agent
.get(path)
.set({
accept: 'application/vnd.github.v3+json'
accept: 'application/vnd.github.v3+json',
authorization: 'token 0000000000000000000000000000000000000001'
})

t.is(status, 200)
Expand Down
9 changes: 6 additions & 3 deletions test/integration/get-repository-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ test('get repository success', async t => {
const { body } = await agent
.get(`${parseUrl(url).path}/repos/octokit-fixture-org/hello-world`)
.set({
accept: 'application/vnd.github.v3+json'
accept: 'application/vnd.github.v3+json',
authorization: 'token 0000000000000000000000000000000000000001'
})

t.is(body.name, 'hello-world')
Expand Down Expand Up @@ -65,7 +66,8 @@ test('get repository with invalid X-Fixtures-Id header', async t => {
const { status, body } = await agent
.get('/api.github.com/fixturesid123/repos/octokit-fixture-org/hello-world')
.set({
accept: 'application/vnd.github.v3+json'
accept: 'application/vnd.github.v3+json',
authorization: 'token 0000000000000000000000000000000000000001'
})

t.is(status, 404)
Expand All @@ -91,7 +93,8 @@ test('get repository with incorrect path', async t => {
const { status, body } = await agent
.get(`${parseUrl(url).path}/foo`)
.set({
accept: 'application/vnd.github.v3+json'
accept: 'application/vnd.github.v3+json',
authorization: 'token 0000000000000000000000000000000000000001'
})

t.is(status, 404)
Expand Down

0 comments on commit 2e1a4ed

Please sign in to comment.