예제 #1
0
 def test_pass(self):
     with patch('m.core.json.read_json') as read_json_mock:
         read_json_mock.return_value = Good(
             dict(
                 owner='jmlopez-rod',
                 repo='m',
                 version='0.0.0',
                 workflow='m_flow',
             ), )
         result = read_config('m')
         config = cast(Config, self.assert_ok(result))
         self.assertIsInstance(config, Config)
         self.assertEqual(
             {
                 **config.__dict__,
                 **dict(
                     owner='jmlopez-rod',
                     repo='m',
                     version='0.0.0',
                     m_dir='m',
                     workflow=Workflow.m_flow,
                 ),
             },
             config.__dict__,
         )
예제 #2
0
 def test_empty_config(self):
     with patch('m.core.json.read_json') as read_json_mock:
         read_json_mock.return_value = Good({})
         result = read_config('m')
         self.assert_issue(result, 'read_config failure')
         err = cast(Issue, cast(Issue, result.value).cause)
         self.assertEqual(err.message, 'multi_get key retrieval failure')
         if isinstance(err.data, list):
             msgs = {x['cause']['message'] for x in err.data}
             self.assertSetEqual(
                 msgs,
                 set([
                     '`owner` path was not found',
                     '`repo` path was not found',
                 ]),
             )
         else:
             raise AssertionError('issue data should be a string')
예제 #3
0
 def test_read_config_fail(self, read_json_mock):
     read_json_mock.return_value = issue('made up issue')
     result = read_config('m')
     self.assert_issue(result, 'read_config failure')