def test_defualt_one_username(self): """ Runs get-identities with one username, confirms correct id returned """ output = self.run_line("globus get-identities " + get_user_data()["clitester1a"]["username"]) self.assertEqual(get_user_data()["clitester1a"]["id"] + "\n", output)
def test_linked_identities(self): """ Confirms --linked-identities sees cliester1a-linked#globusid.org """ output = self.run_line("globus whoami --linked-identities") self.assertIn(get_user_data()["clitester1a"]["username"], output) self.assertIn(get_user_data()["clitester1alinked"]["username"], output)
def test_auth_call(self): """ Runs get-identities using test auth refresh token to confirm test auth refresh token is live and configured correctly """ output = self.run_line("globus get-identities " + get_user_data()["clitester1a"]["username"]) self.assertIn(get_user_data()["clitester1a"]["id"], output)
def test_defualt_one_username(self): """ Runs get-identities with one username, confirms correct id returned """ output = self.run_line( "globus get-identities " + get_user_data()["clitester1a"]["username"] ) self.assertEqual(get_user_data()["clitester1a"]["id"] + "\n", output)
def test_auth_call(self): """ Runs get-identities using test auth refresh token to confirm test auth refresh token is live and configured correctly """ output = self.run_line( "globus get-identities " + get_user_data()["clitester1a"]["username"] ) self.assertIn(get_user_data()["clitester1a"]["id"], output)
def test_verbose_linked_identities(self): """ Confirms combining --verbose and --linked-identities has expected values present for the whole identity set. """ output = self.run_line("globus whoami --linked-identities -v") for field in ["Username", "Name", "Email", "ID"]: self.assertIn(field, output) for field in ["username", "name", "email", "id"]: self.assertIn(get_user_data()["clitester1a"][field], output) self.assertIn(get_user_data()["clitester1alinked"][field], output)
def test_json_raw_string_output(self): """ Get single-field jmespath output and make sure it's quoted """ output = self.run_line("globus whoami --jmespath name").strip() self.assertEquals( '"{}"'.format(get_user_data()["clitester1a"]["name"]), output)
def test_verbose(self): """ Runs get-identities with --verbose, confirms expected fields found """ go_data = get_user_data()["go"] output = self.run_line("globus get-identities --verbose " + go_data["id"]) for key in ["username", "id", "name", "organization", "email"]: self.assertIn(go_data[key], output)
def test_verbose(self): """ Confirms --verbose includes Name, Email, and ID fields. """ output = self.run_line("globus whoami --verbose") for field in ["Username", "Name", "Email", "ID"]: self.assertIn(field, output) for field in ["username", "name", "email", "id"]: self.assertIn(get_user_data()["clitester1a"][field], output)
def test_json(self): """ Runs get-identities with -F json confirms expected values """ go_data = get_user_data()["go"] output = json.loads( self.run_line("globus get-identities -F json " + go_data["id"])) for key in go_data: self.assertIn(go_data[key], output["identities"][0][key])
def test_json(self): """ Runs get-identities with -F json confirms expected values """ go_data = get_user_data()["go"] output = json.loads( self.run_line("globus get-identities -F json " + go_data["id"]) ) for key in go_data: self.assertIn(go_data[key], output["identities"][0][key])
def test_auth_call_no_auth(self): """ Runs get-identities with config set to be empty, confirms No Authentication CLI error. """ output = self.run_line( "globus get-identities " + get_user_data()["clitester1a"]["username"], config={}, assert_exit_code=1, ) self.assertIn("No Authentication provided.", output)
def test_default_multiple_inputs(self): """ Runs get-identities with id username, duplicate and invalid inputs Confirms order is preserved and all values are as expected """ in_vals = [ get_user_data()["clitester1a"]["username"], get_user_data()["clitester1a"]["id"], "invalid", get_user_data()["go"]["username"], get_user_data()["go"]["username"] ] expected = [ get_user_data()["clitester1a"]["id"], get_user_data()["clitester1a"]["username"], "NO_SUCH_IDENTITY", get_user_data()["go"]["id"], get_user_data()["go"]["id"] ] output = self.run_line("globus get-identities " + " ".join(in_vals)) self.assertEqual("\n".join(expected) + "\n", output)
def test_default_multiple_inputs(self): """ Runs get-identities with id username, duplicate and invalid inputs Confirms order is preserved and all values are as expected """ in_vals = [ get_user_data()["clitester1a"]["username"], get_user_data()["clitester1a"]["id"], "invalid", get_user_data()["go"]["username"], get_user_data()["go"]["username"], ] expected = [ get_user_data()["clitester1a"]["id"], get_user_data()["clitester1a"]["username"], "NO_SUCH_IDENTITY", get_user_data()["go"]["id"], get_user_data()["go"]["id"], ] output = self.run_line("globus get-identities " + " ".join(in_vals)) self.assertEqual("\n".join(expected) + "\n", output)
def test_whoami(self): """ Runs whoami to confirm test config successfully setup """ output = self.run_line("globus whoami") self.assertIn(get_user_data()["clitester1a"]["username"], output)
def test_json_raw_string_output(self): """ Get single-field jmespath output and make sure it's quoted """ output = self.run_line("globus whoami --jmespath name").strip() self.assertEquals('"{}"'.format(get_user_data()["clitester1a"]["name"]), output)