Created
November 21, 2019 18:19
-
-
Save themarcelor/1d976784bb29c15d621f0dd61a4cddf2 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| Feature('This is a just a test'); | |
| const readline = require("readline"); | |
| const fenceProps = require('../../services/apis/fence/fenceProps.js'); | |
| const chai = require('chai'); | |
| const {interactive, ifInteractive} = require('../../utils/interactive.js'); | |
| const { Gen3Response, getAccessTokenHeader } = require('../../utils/apiUtil'); | |
| const expect = chai.expect; | |
| // this should be included in the core lib | |
| function requestUserInput(question_text) { | |
| return new Promise((resolve) => { | |
| let rl = readline.createInterface({ | |
| input: process.stdin, | |
| output: process.stdout | |
| }); | |
| rl.question(question_text, (user_input) => { | |
| rl.close(); | |
| resolve(user_input); | |
| }); | |
| }); | |
| } | |
| Scenario(`This is just a test @manual`, ifInteractive( | |
| async(I, fence) => { | |
| let ACCESS_TOKEN = await requestUserInput("Please provide your ACCESS_TOKEN: "); | |
| const http_resp1 = await fence.do.registerGoogleServiceAccount( | |
| { accessTokenHeader: getAccessTokenHeader(ACCESS_TOKEN) }, | |
| { | |
| serviceAccountEmail: 'dcf-some-user-sa@testing.iam.gserviceaccount.com', | |
| id: 'dcf-some-project' | |
| }, | |
| ['phs000999'], | |
| null, | |
| true // setting is_dry_run to true | |
| ); | |
| const http_resp2 = await fence.do.getGoogleSvcAcctMonitor( | |
| { accessTokenHeader: getAccessTokenHeader(ACCESS_TOKEN) }); | |
| const result = await interactive (` | |
| 1. [Automated] This is just a test | |
| Result from Google Service Acct registration Dry Run: ${http_resp1.status} - ${JSON.stringify(http_resp1.body) || http_resp1.parsedFenceError} | |
| Result from Get Monitor request: ${http_resp2.status} - ${JSON.stringify(http_resp2.body) || http_resp2.parsedFenceError} | |
| `); | |
| expect(result.didPass, result.details).to.be.true; | |
| } | |
| )); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment