コード例 #1
0
ファイル: test_coveralls.py プロジェクト: hodgestar/overalls
 def test_upload(self, mock_post):
     c = CoverallsIoUploader()
     r = mk_coverage_results()
     c.upload(r)
     mock_post.assert_called_once()
     [json_file], kw = mock_post.call_args
     self.assertEqual(kw, {})
     self.assertEqual(json.loads(json_file.getvalue()), {
         "service_name": CoverallsIoUploader.DEFAULT_SERVICE_NAME,
         "service_job_id": CoverallsIoUploader.DEFAULT_JOB_ID,
         "source_files": [
             {"coverage": [], "name": "filename", "source": "sour\nce"},
         ],
     })
コード例 #2
0
ファイル: test_cmd.py プロジェクト: hodgestar/overalls
    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()
コード例 #3
0
ファイル: test_core.py プロジェクト: hodgestar/overalls
 def test_results(self):
     c1 = StaticCollector(mk_coverage_results())
     c2 = StaticCollector(mk_coverage_results())
     c = CollectorSet([c1, c2])
     r = c.results()
     self.assertEqual(r.files, c1.results().files + c2.results().files)
コード例 #4
0
ファイル: test_core.py プロジェクト: hodgestar/overalls
 def test_create(self):
     c = StaticCollector(mk_coverage_results())
     self.assertTrue(isinstance(c, Collector))