Skip to content

Commit

Permalink
feat: Add functional test for pipeline token (#1932)
Browse files Browse the repository at this point in the history
* Create sd-local.md

* Add: functional test for pipeline token

* Add: test case

* Add: @ignore tag

* fix: wording and indent

* delete: test case

* add: @ignore

* fix: senario

Co-authored-by: Teppei Minegishi <saka2tetsu@gmail.com>
  • Loading branch information
ibu1224 and sakka2 committed Feb 4, 2020
1 parent 8b092c9 commit b2aa7c7
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 1 deletion.
1 change: 0 additions & 1 deletion design/sd-local.md
Expand Up @@ -199,4 +199,3 @@ Need to be implement the following:

#### Others
- `publish`/`promote` of any `sd-cmd` must not be executed from the `sdlocal` command.

64 changes: 64 additions & 0 deletions features/pipeline-token.feature
@@ -0,0 +1,64 @@
@ignore
@pipelinetoken
Feature: Pipeline Token

A Pipeline token can be created and used in place of a password when
interacting with the regarding pipeline API. This would allow users to obtain valid JWTs and
interact with the Screwdriver API in a programmatic way.

Rules:
- Tokens should be specifically tied to the pipeline that issued them
- Tokens should have a label/name associated with them
- Users can add description to their issued, so they know what they're using them for
- User can see when a token was last used
- Users can revoke a token at any time
- No one can ever look up the raw value after initially generating the token

Background:
Given: "calvin" is logged in

Scenario: Generate New Pipeline Token
Given "calvin" created pipeline dose not own a token named "tiger"
When a new Pipeline token named "tiger" is generated
And the token is used to log in to the specific pipeline
Then a valid JWT is received that represents the pipeline
And the "tiger" token's 'last used' property is updated

Scenario: List Pipeline Tokens
Given "calvin" created pipeline owns an existing Pipeline token named "tiger"
When the pipeline list all tokens
Then "tiger" token is in the list
And the token is safely described

Scenario: Edit Pipeline Tokens
Given "calvin" created pipeline owns an existing Pipeline token named "tiger"
When he changes the label associated with the token
Then the token will have that new label
And the token's 'last used' property will not be update

Scenario: Revoke Pipeline Token
Given "calvin" created pipeline owns an existing Pipeline token named "tiger"
When he revokes the token
And the token is used to log in to the specific pipeline
Then the login attempt fails

Scenario: Refresh Pipeline Token
Given "calvin" created pipeline owns an existing Pipeline token named "tiger"
When he refreshes the token
And the old token value is used to log in to the specific pipeline
Then the login attempt fails
When the new token value is used to log in to the specific pipeline
Then a valid JWT is received that represents the pipeline
And the "tiger" token's 'last used' property is updated

Scenario: Call API using a valid pipeline token
Given "calvin" created pipeline owns an existing Pipeline token named "tiger"
When he calls API using a valid Pipeline token
And the token is used to log in to the specific pipeline
Then he receives valid value from API

Scenario: Call API using a invalid pipeline token
Given "calvin" created pipeline owns an invalid Pipeline token named "tiger"
When he calls API Using a invalid Pipeline token
Then he can not receives the value from API

0 comments on commit b2aa7c7

Please sign in to comment.