Skip to content

Commit

Permalink
Add tests for x_auth_access_type scope for twitter
Browse files Browse the repository at this point in the history
  • Loading branch information
simov committed Mar 8, 2022
1 parent c6b76b7 commit ef39b81
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions test/flow/oauth1.js
Expand Up @@ -190,6 +190,39 @@ describe('oauth1', () => {
})
})

it('scope - request - twitter', async () => {
provider.on.request = ({query}) => {
t.deepEqual(query, {x_auth_access_type: 'read'})
}
var {body: {response}} = await request({
url: client.url('/connect/twitter'),
qs: {scope: ['read']},
cookie: {},
})
t.deepEqual(response, {
access_token: 'token',
access_secret: 'secret',
raw: {oauth_token: 'token', oauth_token_secret: 'secret', user_id: 'id'}
})
})

it('custom_params - request - twitter', async () => {
provider.on.request = ({query}) => {
t.deepEqual(query, {x_auth_access_type: 'read'})
}
var {body: {response}} = await request({
url: client.url('/connect/twitter'),
// request-compose:querystring can't handle nested objects
qs: 'custom_params%5Bx_auth_access_type%5D=read',
cookie: {},
})
t.deepEqual(response, {
access_token: 'token',
access_secret: 'secret',
raw: {oauth_token: 'token', oauth_token_secret: 'secret', user_id: 'id'}
})
})

it('scope - authorize - flickr', async () => {
provider.on.authorize = ({query}) => {
t.deepEqual(query, {perms: 'a,b', oauth_token: 'token'})
Expand Down

0 comments on commit ef39b81

Please sign in to comment.