def test_should_exit_if_a_non_integer_string_is_given(
            self, mock_exit_program):

        ensure_valid_revision('abc')

        mock_exit_program.assert_called_with(
            'Given revision "abc" is not an integer.', return_code=2)
Exemplo n.º 2
0
def extract_repository_url_and_revision_from_arguments(arguments):
    """ Extracts the repository url and the revision from the given
        arguments ensuring that they have valid values. """

    repository_url = ensure_valid_repository_url(arguments[ARGUMENT_REPOSITORY])
    revision = ensure_valid_revision(arguments[ARGUMENT_REVISION])
    return repository_url, revision
Exemplo n.º 3
0
def extract_repository_url_and_revision_from_arguments(arguments):
    """ Extracts the repository url and the revision from the given
        arguments ensuring that they have valid values. """

    repository_url = ensure_valid_repository_url(
        arguments[ARGUMENT_REPOSITORY])
    revision = ensure_valid_revision(arguments[ARGUMENT_REVISION])
    return repository_url, revision
    def test_should_return_revision_if_a_integer_string_is_given(self, mock_exit_program):

        actual_revision = ensure_valid_revision('123')

        self.assertEqual('123', actual_revision)
    def test_should_not_exit_if_a_integer_string_is_given(self, mock_exit_program):

        ensure_valid_revision('123')

        self.assertEqual(None, mock_exit_program.call_args)
    def test_should_exit_if_a_non_integer_string_is_given(self, mock_exit_program):

        ensure_valid_revision('abc')

        mock_exit_program.assert_called_with('Given revision "abc" is not an integer.', return_code=2)
    def test_should_return_revision_if_a_integer_string_is_given(
            self, mock_exit_program):

        actual_revision = ensure_valid_revision('123')

        self.assertEqual('123', actual_revision)
    def test_should_not_exit_if_a_integer_string_is_given(
            self, mock_exit_program):

        ensure_valid_revision('123')

        self.assertEqual(None, mock_exit_program.call_args)