def test_set_appid_from_account_id(self, isfile_mock, parse_mock): isfile_mock.return_value = True parse_mock.return_value = None config = Config(['aws_okta_keyman.py']) config.accounts = [{'appid': 'A123'}] config.set_appid_from_account_id(0) self.assertEqual(config.appid, 'A123')
def test_validate_automatic_username_from_none(self, getpass_mock): getpass_mock.getuser.return_value = 'user' config = Config(['aws_okta_keyman.py']) config.accounts = [{'appid': 'A123'}] config.org = 'example' config.validate() self.assertEqual(config.username, 'user')
def test_set_appid_from_account_id(self, isfile_mock, parse_mock): isfile_mock.return_value = True parse_mock.return_value = None config = Config(["aws_okta_keyman.py"]) config.accounts = [{"appid": "A123"}] config.set_appid_from_account_id(0) self.assertEqual(config.appid, "A123")
def test_validate_automatic_username_from_full_config(self, getpass_mock): getpass_mock.getuser.return_value = "user" config = Config(["aws_okta_keyman.py"]) config.accounts = [{"appid": "A123"}] config.org = "example" config.username = "******" config.validate() self.assertEqual(config.username, "*****@*****.**")
def test_validate_missing_org(self): config = Config(['aws_okta_keyman.py']) config.accounts = [{'appid': 'A123'}] config.username = '******' with self.assertRaises(ValueError): config.validate()
def test_validate_good_with_accounts(self): config = Config(['aws_okta_keyman.py']) config.accounts = [{'appid': 'A123'}] config.org = 'example' config.username = '******' self.assertEqual(config.validate(), None)
def test_validate_good_with_accounts(self): config = Config(["aws_okta_keyman.py"]) config.accounts = [{"appid": "A123"}] config.org = "example" config.username = "******" self.assertEqual(config.validate(), None)