def test_arg_board(self, mock_format, mock_epics, mock_sprints, mock_board, mock_userconfig_users, mock_keyring): # pylint: disable=W0613,R0913 """ Test board argument """ mock_board.return_value = BOARD mock_epics.return_value = iter([]) mock_sprints.return_value = iter([]) jira_main() mock_format.assert_called_with(BOARD) mock_sprints.assert_called_with('{}'.format(BOARD.id_)) mock_epics.assert_called_with('{}'.format(BOARD.id_))
def test_arg_jql(self, mock_format, mock_service, mock_userconfig_users, mock_keyring): # pylint: disable=W0613 """ Test jql argument """ mock_service.return_value = iter([ISSUES]) jira_main() mock_format.assert_called_with(ISSUES)
def test_arg_boards(self, mock_format, mock_service, mock_userconfig_users, mock_keyring): # pylint: disable=W0613,R0913 """ Test board argument """ mock_service.return_value = iter([BOARDS]) jira_main() mock_format.assert_called_with(BOARDS)
def test_arg_myself(self, mock_format, mock_service, mock_userconfig_users, mock_keyring): # pylint: disable=W0613 """ test myself argument """ mock_service.return_value = MYSELF jira_main() mock_format.assert_called_with(MYSELF)
def test_arg_issue(self, mock_format, mock_service, mock_userconfig_users, mock_keyring): # pylint: disable=W0613 """ Test issue argument """ mock_service.return_value = ISSUE jira_main() mock_format.assert_called_with(ISSUE)
def test_arg_backlog(self, mock_format, mock_service, mock_userconfig_users, mock_keyring): # # pylint: disable=W0613 """ Test version argument """ mock_service.return_value = iter([VERSIONS]) jira_main() mock_format.assert_called_with(VERSIONS)
def test_arg_epic(self, mock_format, mock_service, mock_userconfig_users, mock_keyring): # pylint: disable=W0613 """ Test epic argument """ mock_service.return_value = EPIC jira_main() mock_format.assert_called_with(EPIC)
def test_arg_sprint_issues(self, mock_format, mock_sprint, mock_userconfig_users, mock_keyring): # pylint: disable=W0613 """ Test sprint argument """ mock_sprint.return_value = iter([ISSUES]) jira_main() mock_format.assert_called_with(ISSUES)
def test_arg_sprint(self, mock_format, mock_sprint, mock_userconfig_users, mock_keyring): # pylint: disable=W0613 """ Test sprint argument """ mock_sprint.return_value = SPRINT jira_main() mock_format.assert_called_with(SPRINT)
from mock import patch, mock_open from atlassian_cli.bitbucket_cli import main as bitbucket_main from atlassian_cli.jira_cli import main as jira_main from atlassian_cli import ( BITBUCKET_CLI_PROG, JIRA_CLI_PROG ) from atlassian_cli.metadata import APPLICATION_VERSION # pylint: disable=R0201, C0122, W0108 @pytest.mark.parametrize("prog,main", [ (BITBUCKET_CLI_PROG, (lambda: bitbucket_main())), (JIRA_CLI_PROG, (lambda: jira_main())), ]) class CLITestCase: """ basic CLI testing class """ @patch('os.path.exists', return_value=True) @patch('builtins.open', mock_open(read_data=b' ')) def test_with_empty_args(self, mock_builtins_open, capsys, prog, main): """ test with empty arguments """ with pytest.raises(SystemExit): main() _, err = capsys.readouterr() assert err.startswith('usage: {}'.format(prog)) @patch('os.path.exists', return_value=True) @patch('builtins.open', mock_open(read_data=b' '))