def test_version_add_badversion(self): with assertRaisesRegex(self, command.CommandException, 'Invalid version format'): command.version_add('user/test', '2.9.12.2error', 'fabc123', force=True)
def test_version_add_confirmed(self, mock_input, mock_match_hash): registry_url = command.get_registry_url() mock_input.return_value = 'y' mock_match_hash.return_value = 'fabc123' # Response content is not checked by version_add, so # status ok and URL verification are enough self.requests_mock.add( responses.PUT, registry_url + "/api/version/user/test/2.9.12", status=200, ) command.version_add('user/test', '2.9.12', 'fabc123')
def test_version_add_declined(self, mock_input): mock_input.return_value = 'n' command.version_add( 'user/test', '2.9.12', 'fabc123') # should produce no mock network activity