-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Generalized support for better authentication
Added the following new steps: 1. `/^I am an? "([^"]*)"$/` E.g. "Given I am an "admin". ...which will explicity create a SuperAgent agent that can be reused across scenarios. This is useful so that actions like requesting an oauth2 bearer token are repeated when they only need to be performed onnce. This also is part of an effort to simplify code responsible for setting and reusing agents. The previous approach tried to make it implicit, but I think was confusing and in some scenarios not reliable due to the way we generated the agent's dictionary key. 2. `I am using basic authentication using credentials from: {string}` and `I am using basic authentication with the credentials:` plus short forms. Adds support for Basic auth
- Loading branch information
Philip Mander
committed
Jul 3, 2019
1 parent
f7e4996
commit 87ea1de
Showing
7 changed files
with
179 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"values": [ | ||
{ | ||
"key": "username", | ||
"value": "<username>", | ||
"enabled": true | ||
}, | ||
{ | ||
"key": "password", | ||
"value": "<password>", | ||
"enabled": true | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// Copyright 2019 Harver B.V. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
const { setWorldConstructor, After, AfterAll, Before, BeforeAll, Given, When, Then } = require('cucumber'); | ||
const { registerHooks, World: BaseWorld, registerSteps } = require('../../../src/index'); | ||
|
||
class World extends BaseWorld { | ||
constructor() { | ||
super(); | ||
} | ||
} | ||
|
||
setWorldConstructor(World); | ||
registerHooks({ After, AfterAll, Before, BeforeAll }); | ||
registerSteps({ Given, Then, When }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Copyright 2019 Harver B.V. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
Feature: Twitter Standard search API | ||
|
||
Returns a collection of relevant Tweets matching a specified query. | ||
|
||
Background: Set up common auth | ||
Given I am a "twitter client" | ||
And I am using basic authentication using credentials from: "./examples/auth.json" | ||
And get token from "https://api.twitter.com/oauth2/token" using: | ||
| grant_type | client_credentials | | ||
|
||
Scenario: Search for tweets containing "Trump" | ||
When I send a 'GET' request to 'https://api.twitter.com/1.1/search/tweets.json' | ||
And I add the query string parameters: | ||
| q | Trump | | ||
Then I should receive a response with the status 200 | ||
|
||
Scenario: Search for Tweets containing "Boris" | ||
When I send a 'GET' request to 'https://api.twitter.com/1.1/search/tweets.json' | ||
And I add the query string parameters: | ||
| q | Boris | | ||
Then I should receive a response with the status 200 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters