def test_none(self, mock_component, mock_is): mock_is.assert_not_called() self.mock_from_version.assert_not_called() mock_component.assert_not_called() self.mock_get_current_branch.assert_not_called() self.mock_get_active_branch.assert_not_called() self.assertEqual(SemVer.process_version().__repr__(), '0.0.0') mock_is.assert_not_called() self.mock_from_version.assert_not_called() mock_component.assert_not_called() self.mock_get_current_branch.assert_not_called() self.mock_get_active_branch.assert_called_once_with()
def test_weird_version(self, mock_component, mock_is): mock_is.assert_not_called() self.mock_from_version.assert_not_called() mock_component.assert_not_called() self.mock_get_current_branch.assert_not_called() self.mock_get_active_branch.assert_not_called() self.assertEqual(SemVer.process_version(self.WEIRD_VERSION), self.WEIRD_VERSION) mock_is.assert_called_once_with(self.WEIRD_VERSION) self.mock_from_version.assert_not_called() mock_component.assert_called_once_with(self.WEIRD_VERSION) self.mock_get_current_branch.assert_not_called() self.mock_get_active_branch.assert_not_called()
def test_semver(self, mock_component, mock_is): mock_is.assert_not_called() self.mock_from_version.assert_not_called() mock_component.assert_not_called() self.mock_get_current_branch.assert_not_called() self.mock_get_active_branch.assert_not_called() self.assertEqual( SemVer.process_version(self.SEMVER).__repr__(), self.FROM_VERSION.__repr__()) mock_is.assert_called_once_with(self.SEMVER) self.mock_from_version.assert_called_once_with(self.SEMVER) mock_component.assert_not_called() self.mock_get_current_branch.assert_not_called() self.mock_get_active_branch.assert_not_called()
def execute(self, parsed_args): """Executes its action""" version = ( SemVer.process_version(parsed_args.version) if self.has_version and hasattr(parsed_args, 'version') else SemVer() ) if version is None: raise ValueError( 'Version was not passed in and the repo is not on a release branch' ) base = ( parsed_args.base if self.has_base and hasattr(parsed_args, 'base') else None ) options = ( parsed_args.options if hasattr(parsed_args, 'options') else None ) for command in self.release_commands: Subcommand.execute_release_command(command, version, base, options)