| Total Complexity | 2 |
| Total Lines | 22 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | from build_job import BuildJobAction |
||
| 6 | class BuildJobActionTestCase(TeamCityBaseActionTestCase): |
||
| 7 | __test__ = True |
||
| 8 | action_cls = BuildJobAction |
||
| 9 | |||
| 10 | def test_run_api_404(self): |
||
| 11 | action, adapter = self._get_action_status_code( |
||
| 12 | 'POST', |
||
| 13 | "mock://example.teamcityagent.com:8080/httpAuth/rest/buildQueue", |
||
| 14 | status_code=404) |
||
| 15 | |||
| 16 | self.assertRaises(ValueError, action.run, "test", "testbranch") |
||
| 17 | |||
| 18 | def test_run_api_success(self): |
||
| 19 | expected = self.load_json("build_job.json") |
||
| 20 | |||
| 21 | action, adapter = self.__get_mocked_action() |
||
| 22 | adapter.register_uri('POST', |
||
| 23 | "mock://example.teamcityagent.com:8080/httpAuth/rest/buildQueue", |
||
| 24 | text=self.get_fixture_content("build_job,json")) |
||
| 25 | |||
| 26 | result = action.run("test", "testbranch") |
||
| 27 | self.assertEqual(result, expected) |
||
| 28 |