コード例 #1
0
ファイル: test_configure.py プロジェクト: zsjohny/aws-cli
 def test_non_secret_keys_are_not_masked(self):
     prompter = configure.InteractivePrompter()
     prompter.get_value(current_value='mycurrentvalue',
                        config_name='not_a_secret_key',
                        prompt_text='Enter value')
     # We should also not display the entire secret key.
     prompt_text = self.mock_raw_input.call_args[0][0]
     self.assertIn('mycurrentvalue', prompt_text)
     self.assertRegexpMatches(prompt_text, r'\[mycurrentvalue\]')
コード例 #2
0
ファイル: test_configure.py プロジェクト: zsjohny/aws-cli
 def test_secret_key_is_masked(self):
     prompter = configure.InteractivePrompter()
     prompter.get_value(current_value='mysupersecretkey',
                        config_name='aws_secret_access_key',
                        prompt_text='Secret Key')
     # We should also not display the entire secret key.
     prompt_text = self.mock_raw_input.call_args[0][0]
     self.assertNotIn('mysupersecretkey', prompt_text)
     self.assertRegexpMatches(prompt_text, r'\[\*\*\*\*.*\]')
コード例 #3
0
ファイル: test_configure.py プロジェクト: zsjohny/aws-cli
 def test_access_key_not_masked_when_none(self):
     self.mock_raw_input.return_value = 'foo'
     prompter = configure.InteractivePrompter()
     response = prompter.get_value(current_value=None,
                                   config_name='aws_access_key_id',
                                   prompt_text='Access key')
     # First we should return the value from raw_input.
     self.assertEqual(response, 'foo')
     prompt_text = self.mock_raw_input.call_args[0][0]
     self.assertIn('[None]', prompt_text)
コード例 #4
0
ファイル: test_configure.py プロジェクト: zsjohny/aws-cli
    def test_user_hits_enter_returns_none(self):
        # If a user hits enter, then raw_input returns the empty string.
        self.mock_raw_input.return_value = ''

        prompter = configure.InteractivePrompter()
        response = prompter.get_value(current_value=None,
                                      config_name='aws_access_key_id',
                                      prompt_text='Access key')
        # We convert the empty string to None to indicate that there
        # was no input.
        self.assertIsNone(response)
コード例 #5
0
ファイル: test_configure.py プロジェクト: zsjohny/aws-cli
 def test_access_key_is_masked(self):
     self.mock_raw_input.return_value = 'foo'
     prompter = configure.InteractivePrompter()
     response = prompter.get_value(current_value='myaccesskey',
                                   config_name='aws_access_key_id',
                                   prompt_text='Access key')
     # First we should return the value from raw_input.
     self.assertEqual(response, 'foo')
     # We should also not display the entire access key.
     prompt_text = self.mock_raw_input.call_args[0][0]
     self.assertNotIn('myaccesskey', prompt_text)
     self.assertRegexpMatches(prompt_text, r'\[\*\*\*\*.*\]')