コード例 #1
0
 def test_user_config_full_config(self, open_mock):
     user_conf = user_config.UserConfig('/path')
     full_dict = {
         'run': {
             'concurrency': 42,
             'random': True,
             'no-subunit-trace': True,
             'color': True,
             'abbreviate': True,
             'slowest': True,
             'suppress-attachments': True,
             'all-attachments': True
         },
         'failing': {
             'list': True
         },
         'last': {
             'no-subunit-trace': True,
             'color': True,
             'suppress-attachments': True,
             'all-attachments': True
         },
         'load': {
             'force-init': True,
             'subunit-trace': True,
             'color': True,
             'abbreviate': True,
             'suppress-attachments': True,
             'all-attachments': True
         }
     }
     self.assertEqual(full_dict, user_conf.config)
コード例 #2
0
ファイル: test_user_config.py プロジェクト: xarses/stestr
 def test_user_config_invalid_integer(self, open_mock, exit_mock):
     temp_out = sys.stdout
     std_out = six.StringIO()
     sys.stdout = std_out
     self.addCleanup(self._restore_stdout, temp_out)
     user_config.UserConfig('/path')
     exit_mock.assert_called_once_with(1)
     error_string = ("Provided user config file /path is invalid because:\n"
                     "expected int for dictionary value @ "
                     "data['run']['concurrency']")
     std_out.seek(0)
     self.assertEqual(error_string, std_out.read().rstrip())
コード例 #3
0
ファイル: test_user_config.py プロジェクト: xarses/stestr
    def test_user_config_invalid_command(self, exit_mock, yaml_mock):

        temp_out = sys.stdout
        std_out = six.StringIO()
        sys.stdout = std_out
        self.addCleanup(self._restore_stdout, temp_out)
        user_config.UserConfig('/path')
        exit_mock.assert_called_once_with(1)
        error_string = ("Provided user config file /path is invalid because:\n"
                        "extra keys not allowed @ data['init']")
        std_out.seek(0)
        self.assertEqual(error_string, std_out.read().rstrip())
コード例 #4
0
 def test_user_config_invalid_integer(self, open_mock, exit_mock):
     user_config.UserConfig('/path')
     error_string = ("Provided user config file /path is invalid because:\n"
                     "expected int for dictionary value @ "
                     "data['run']['concurrency']")
     exit_mock.assert_called_once_with(error_string)
コード例 #5
0
 def test_user_config_invalid_option(self, exit_mock, yaml_mock):
     user_config.UserConfig('/path')
     error_string = ("Provided user config file /path is invalid because:\n"
                     "extra keys not allowed @ "
                     "data['run']['subunit-trace']")
     exit_mock.assert_called_once_with(error_string)
コード例 #6
0
 def test_user_config_invalid_command(self, exit_mock, yaml_mock):
     user_config.UserConfig('/path')
     error_string = ("Provided user config file /path is invalid because:\n"
                     "extra keys not allowed @ data['init']")
     exit_mock.assert_called_once_with(error_string)
コード例 #7
0
 def test_user_config_empty_schema(self, yaml_mock):
     user_conf = user_config.UserConfig('/path')
     self.assertEqual({}, user_conf.config)