def test_scratch_org_username(self): """ Scratch Org credentials are passed by -u flag """ self.task_config.config["options"] = {"command": "force:org --help"} org_config = ScratchOrgConfig({"username": "******"}, "test") task = SFDXOrgTask(self.project_config, self.task_config, org_config) self.assertIn("-u [email protected]", task._get_command())
def test_scratch_org_username(self): """ Scratch Org credentials are passed by -u flag """ self.task_config.config["options"] = {"command": "force:org --help"} org_config = OrgConfig( {"access_token": "test access token", "instance_url": "test instance url"}, "test", ) task = SFDXOrgTask(self.project_config, self.task_config, org_config) try: task() except CommandException: pass env = task._get_env() print(env) self.assertEquals(env.get("SFDX_USERNAME"), "test access token") self.assertEquals(env.get("SFDX_INSTANCE_URL"), "test instance url")
def test_keychain_org_creds(self): """ Keychain org creds are passed by env var """ self.task_config.config["options"] = {"command": "force:org --help"} access_token = "00d123" org_config = OrgConfig( { "access_token": access_token, "instance_url": "https://test.salesforce.com", }, "test", ) task = SFDXOrgTask(self.project_config, self.task_config, org_config) try: task() except CommandException: pass self.assertIn("SFDX_INSTANCE_URL", task._get_env()) self.assertIn("SFDX_DEFAULTUSERNAME", task._get_env()) self.assertIn(access_token, task._get_env()["SFDX_DEFAULTUSERNAME"])
def test_keychain_org_creds(self): """ Keychain org creds are passed by env var """ self.task_config.config["options"] = {"command": "force:org --help"} access_token = "00d123" org_config = OrgConfig( { "access_token": access_token, "instance_url": "https://test.salesforce.com", }, "test", ) task = SFDXOrgTask(self.project_config, self.task_config, org_config) try: task() except CommandException: pass self.assertIn("SFDX_INSTANCE_URL", task._get_env()) self.assertIn("SFDX_USERNAME", task._get_env()) self.assertIn(access_token, task._get_env()["SFDX_USERNAME"])
def test_scratch_org_username(self): """ Scratch Org credentials are passed by -u flag """ self.task_config.config['options'] = { 'command': 'force:org --help', } org_config = OrgConfig( { 'access_token': 'test access token', 'instance_url': 'test instance url', }, 'test') task = SFDXOrgTask(self.project_config, self.task_config, org_config) try: task() except CommandException: pass env = task._get_env() print(env) self.assertEquals(env.get('SFDX_USERNAME'), 'test access token') self.assertEquals(env.get('SFDX_INSTANCE_URL'), 'test instance url')
def test_keychain_org_creds(self): """ Keychain org creds are passed by env var """ self.task_config.config['options'] = { 'command': 'force:org --help', } access_token = '00d123' org_config = OrgConfig( { 'access_token': access_token, 'instance_url': 'https://test.salesforce.com' }, 'test') task = SFDXOrgTask(self.project_config, self.task_config, org_config) try: task() except CommandException: pass self.assertIn('SFDX_INSTANCE_URL', task._get_env()) self.assertIn('SFDX_USERNAME', task._get_env()) self.assertIn(access_token, task._get_env()['SFDX_USERNAME'])