コード例 #1
0
 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')
コード例 #2
0
 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')
コード例 #3
0
 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")
コード例 #4
0
 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, "*****@*****.**")
コード例 #5
0
 def test_validate_missing_org(self):
     config = Config(['aws_okta_keyman.py'])
     config.accounts = [{'appid': 'A123'}]
     config.username = '******'
     with self.assertRaises(ValueError):
         config.validate()
コード例 #6
0
 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)
コード例 #7
0
 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)