class AlreadyVotedException(AurwebException):
    def __init__(self, comment):
        msg = 'already voted for package base: {:s}'.format(comment)
        super(AlreadyVotedException, self).__init__(msg) class AurwebException(Exception):
    pass class BannedException(AurwebException):
    pass class BrokenUpdateHookException(AurwebException):
    def __init__(self, cmd):
        msg = 'broken update hook: {:s}'.format(cmd)
        super(BrokenUpdateHookException, self).__init__(msg) class InvalidArgumentsException(AurwebException):
    def __init__(self, msg):
        super(InvalidArgumentsException, self).__init__(msg) class InvalidCommentException(AurwebException):
    def __init__(self, comment):
        msg = 'comment is too short: {:s}'.format(comment)
        super(InvalidCommentException, self).__init__(msg) class InvalidPackageBaseException(AurwebException):
    def __init__(self, pkgbase):
        msg = 'package base not found: {:s}'.format(pkgbase)
        super(InvalidPackageBaseException, self).__init__(msg) class InvalidReasonException(AurwebException):
    def __init__(self, reason):
        msg = 'invalid reason: {:s}'.format(reason)
        super(InvalidReasonException, self).__init__(msg) class InvalidRepositoryNameException(AurwebException):
    def __init__(self, pkgbase):
        msg = 'invalid repository name: {:s}'.format(pkgbase)
        super(InvalidRepositoryNameException, self).__init__(msg) class InvalidUserException(AurwebException):
    def __init__(self, user):
        msg = 'unknown user: {:s}'.format(user)
        super(InvalidUserException, self).__init__(msg) class MaintenanceException(AurwebException):
    pass class NotVotedException(AurwebException):
    def __init__(self, comment):
        msg = 'missing vote for package base: {:s}'.format(comment)
        super(NotVotedException, self).__init__(msg) class PackageBaseExistsException(AurwebException):
    def __init__(self, pkgbase):
        msg = 'package base already exists: {:s}'.format(pkgbase)
        super(PackageBaseExistsException, self).__init__(msg) class PermissionDeniedException(AurwebException):
    def __init__(self, user):
        msg = 'permission denied: {:s}'.format(user)
        super(PermissionDeniedException, self).__init__(msg)
from aurweb.exceptions import (AlreadyVotedException, AurwebException, BannedException, BrokenUpdateHookException,
                               InvalidArgumentsException, InvalidCommentException, InvalidPackageBaseException,
                               InvalidReasonException, InvalidRepositoryNameException, InvalidUserException,
                               MaintenanceException, NotVotedException, PackageBaseExistsException, PermissionDeniedException)


def test_aurweb_exception():
    try:
        raise AurwebException("test")
    except AurwebException as exc:
        assert str(exc) == "test"


def test_maintenance_exception():
    try:
        raise MaintenanceException("test")
    except MaintenanceException as exc:
        assert str(exc) == "test"


def test_banned_exception():
    try:
        raise BannedException("test")
    except BannedException as exc:
        assert str(exc) == "test"


def test_already_voted_exception():
    try:
        raise AlreadyVotedException("test")
    except AlreadyVotedException as exc:
        assert str(exc) == "already voted for package base: test"


def test_broken_update_hook_exception():
    try:
        raise BrokenUpdateHookException("test")
    except BrokenUpdateHookException as exc:
        assert str(exc) == "broken update hook: test"


def test_invalid_arguments_exception():
    try:
        raise InvalidArgumentsException("test")
    except InvalidArgumentsException as exc:
        assert str(exc) == "test"


def test_invalid_packagebase_exception():
    try:
        raise InvalidPackageBaseException("test")
    except InvalidPackageBaseException as exc:
        assert str(exc) == "package base not found: test"


def test_invalid_comment_exception():
    try:
        raise InvalidCommentException("test")
    except InvalidCommentException as exc:
        assert str(exc) == "comment is too short: test"


def test_invalid_reason_exception():
    try:
        raise InvalidReasonException("test")
    except InvalidReasonException as exc:
        assert str(exc) == "invalid reason: test"


def test_invalid_user_exception():
    try:
        raise InvalidUserException("test")
    except InvalidUserException as exc:
        assert str(exc) == "unknown user: test"


def test_not_voted_exception():
    try:
        raise NotVotedException("test")
    except NotVotedException as exc:
        assert str(exc) == "missing vote for package base: test"


def test_packagebase_exists_exception():
    try:
        raise PackageBaseExistsException("test")

    except PackageBaseExistsException as exc: