use of harness.TestUser in project terra-cli by DataBiosphere.
the class BqTableReferenced method numRowsForReferencedWithNoAccess.
@Test
@DisplayName("referenced dataset with no access does not fail the describe command")
void numRowsForReferencedWithNoAccess() throws IOException {
workspaceCreator.login();
// `terra workspace set --id=$id`
TestCommand.runCommandExpectSuccess("workspace", "set", "--id=" + getUserFacingId());
// `terra resource add-ref bq-table --name=$name --project-id=$projectId
// --dataset-id=$datasetId`
String name = "numRowsForReferencedWithNoAccess";
TestCommand.runCommandExpectSuccess("resource", "add-ref", "bq-table", "--name=" + name, "--project-id=" + externalDataset.getProjectId(), "--dataset-id=" + externalDataset.getDatasetId(), "--table-id=" + externalDataTableName);
// `terra resource describe --name=$name`
UFBqTable describeDataTable = TestCommand.runAndParseCommandExpectSuccess(UFBqTable.class, "resource", "describe", "--name=" + name);
assertEquals(BigInteger.ZERO, describeDataTable.numRows, "referenced dataset with access and has zero row.");
// `terra workspace add-user --email=$email --role=READER`
TestUser shareeUser = TestUser.chooseTestUserWhoIsNot(workspaceCreator);
TestCommand.runCommandExpectSuccess("workspace", "add-user", "--email=" + shareeUser.email, "--role=READER");
shareeUser.login();
// `terra resource describe --name=$name`
UFBqTable shareeDescribeDataTable = TestCommand.runAndParseCommandExpectSuccess(UFBqTable.class, "resource", "describe", "--name=" + name);
// the external dataset created in the beforeall method should have 1 table in it, but the
// sharee user doesn't have read access to the table so they can't know that
assertNull(shareeDescribeDataTable.numRows, "referenced dataset with no access contains NULL numRows");
}
use of harness.TestUser in project terra-cli by DataBiosphere.
the class Nextflow method nextflowFromGLSTutorial.
@Test
@DisplayName("nextflow config and run with GLS tutorial")
void nextflowFromGLSTutorial() throws IOException {
// select a test user and login
TestUser testUser = TestUser.chooseTestUserWithSpendAccess();
testUser.login();
// create a workspace
int exitCode = TestBashScript.runScript("CreateWorkspace.sh");
assertEquals(0, exitCode, "workspace created without errors");
// run the script that downloads the NF workflow from GH and runs it
exitCode = TestBashScript.runScript("NextflowRnaseq.sh");
// check that the NF script ran successfully
assertEquals(0, exitCode, "script completed without errors");
}
use of harness.TestUser in project terra-cli by DataBiosphere.
the class AuthLoginLogout method checkEnabled.
@Test
@DisplayName("all test users enabled in SAM")
void checkEnabled() throws IOException {
// check that each test user is enabled in SAM
for (TestUser testUser : TestUser.getTestUsers()) {
// login the user, so we have their credentials
testUser.login();
// check that the user is enabled
UserStatusInfo userStatusInfo = SamService.fromContext().getUserInfoForSelf();
assertTrue(userStatusInfo.getEnabled(), "test user is enabled in SAM");
// `terra auth revoke`
TestCommand.runCommandExpectSuccess("auth", "revoke");
}
}
use of harness.TestUser in project terra-cli by DataBiosphere.
the class AuthLoginLogout method logoutTestUser.
@Test
@DisplayName("test user logout updates global context")
void logoutTestUser() throws IOException {
// select a test user and login
TestUser testUser = TestUser.chooseTestUser();
testUser.login();
// `terra auth revoke`
TestCommand.runCommandExpectSuccess("auth", "revoke");
// check that the credential store on disk is empty
DataStore<StoredCredential> dataStore = TestUser.getCredentialStore();
assertEquals(0, dataStore.keySet().size(), "credential store is empty");
// read the global context in from disk again to check what got persisted
// check that the current user in the global context is unset
Optional<User> currentUser = Context.getUser();
assertFalse(currentUser.isPresent(), "current user unset in global context");
}
use of harness.TestUser in project terra-cli by DataBiosphere.
the class AuthStatus method authRevokeChanges.
@Test
@DisplayName("auth status changes after logout")
void authRevokeChanges() throws IOException {
// select a test user and login
TestUser testUser = TestUser.chooseTestUser();
testUser.login();
// `terra auth status --format=json`
UFAuthStatus authStatus = TestCommand.runAndParseCommandExpectSuccess(UFAuthStatus.class, "auth", "status");
// check that it says logged in
assertTrue(authStatus.loggedIn, "auth status indicates user is logged in");
// `terra auth revoke`
TestCommand.runCommandExpectSuccess("auth", "revoke");
// `terra auth status --format=json`
authStatus = TestCommand.runAndParseCommandExpectSuccess(UFAuthStatus.class, "auth", "status");
// check that it says logged out
assertFalse(authStatus.loggedIn, "auth status indicates user is logged out");
}
Aggregations