Exemplo n.º 1
0
 def test_show_build(self):
     # set return values
     self.mock_get_credential.return_value = self._TEST_PAT_TOKEN
     self.mock_validate_token.return_value = True
     response = build_show(id=12345, open=False, organization=self._TEST_DEVOPS_ORGANIZATION, 
         project='testproject', detect=None)
     #assert
     self.mock_get_build.assert_called_once_with(build_id=12345, project='testproject')
     self.mock_open_browser.assert_not_called()
Exemplo n.º 2
0
 def test_show_build(self):
     # set return values
     response = build_show(id=12345,
                           open=False,
                           organization=self._TEST_DEVOPS_ORGANIZATION,
                           project='testproject',
                           detect=None)
     #assert
     self.mock_get_build.assert_called_once_with(build_id=12345,
                                                 project='testproject')
     self.mock_open_browser.assert_not_called()
Exemplo n.º 3
0
 def test_show_build_with_open_browser(self):
     # set return values
     self.mock_get_build.return_value = "dummy_build"
     response = build_show(id=12345,
                           open=True,
                           organization=self._TEST_DEVOPS_ORGANIZATION,
                           project='testproject',
                           detect=None)
     #assert
     self.mock_get_build.assert_called_once_with(build_id=12345,
                                                 project='testproject')
     self.mock_open_browser.assert_called_once_with(
         "dummy_build", self._TEST_DEVOPS_ORGANIZATION)
Exemplo n.º 4
0
    def test_show_build_with_detected_project_org(self):
        _DUMMY_INSTANCE = 'dummy_instance'
        _DUMMY_PROJECT = 'dummy_project'
        _DUMMY_BUILD = 'dummy_build'
        _DUMMY_REPO = 'dummy_repo'
        with patch('azext_devops.dev.common.services.resolve_instance_project_and_repo') as mock_resolve_instance_project_repo:
            mock_resolve_instance_project_repo.return_value = _DUMMY_INSTANCE, _DUMMY_PROJECT, _DUMMY_REPO

            # set return values
            self.mock_get_credential.return_value = self._TEST_PAT_TOKEN
            self.mock_validate_token.return_value = True
            self.mock_get_build.return_value = _DUMMY_BUILD

            response = build_show(id=12345)

            #assert
            mock_resolve_instance_project_repo.assert_called_once()
            self.mock_get_build.assert_called_once_with(build_id=12345, project=_DUMMY_PROJECT)
            self.mock_open_browser.assert_not_called()