def test_run(self, log_mock): u = OverallsUploader() args = u.parser.parse_args([]) collector = StaticCollector(mk_coverage_results()) uploader = CoverallsIoUploader() upload_calls = [] u.parser.parse_args = lambda: args u.create_uploader = lambda args: uploader u.create_collector = lambda args: collector uploader.upload = upload_calls.append u.run() self.assertEqual(upload_calls, [collector.results()]) log_mock.assert_not_called()
def test_create_uploader(self): u = OverallsUploader() uploader = u.create_uploader(u.parser.parse_args([])) self.assertTrue(isinstance(uploader, CoverallsIoUploader))
def test_create_collector_py(self, py_mock): u = OverallsUploader() c = u.create_collector(u.parser.parse_args(['--py'])) py_mock.assert_called_once_with() self.assertEqual(c._collectors, [py_mock.return_value])
def test_create_collector_lcov(self, open_mock, lcov_mock): u = OverallsUploader() c = u.create_collector(u.parser.parse_args(['--lcov', 'test'])) lcov_mock.assert_called_once_with(open_mock.return_value) open_mock.assert_called_once_with('test') self.assertEqual(c._collectors, [lcov_mock.return_value])
def test_create_collector_empty(self): u = OverallsUploader() c = u.create_collector(u.parser.parse_args([])) r = c.results() self.assertEqual(r.files, [])