Пример #1
0
    def remove_account(account_name: str) -> bool:
        """
        Remove account from whitelist.
        :param account_name: account name for removing
        :return: has the account existed before?
        """
        account_existed = False

        if WhitelistModel.get_account(account_name):
            WhitelistModel.remove_account(account_name)
            logger.info(f"Account {account_name!r} removed from postgres whitelist!")
            account_existed = True

        if not account_existed:
            logger.info(f"Account {account_name!r} does not exists!")

        return account_existed
Пример #2
0
    def remove_account(account_name: str) -> bool:
        """
        Remove account from whitelist.
        :param account_name: github login
        :return:
        """

        account_existed = False

        if WhitelistModel.get_account(account_name):
            WhitelistModel.remove_account(account_name)
            logger.info(f"Account: {account_name} removed from postgres whitelist!")
            account_existed = True

        if not account_existed:
            logger.info(f"Account: {account_name} does not exists!")

        return account_existed
Пример #3
0
def test_remove_account(clean_before_and_after, multiple_whitelist_entries):
    assert WhitelistModel.get_account("Rayquaza").account_name == "Rayquaza"
    WhitelistModel.remove_account("Rayquaza")
    assert WhitelistModel.get_account("Rayquaza") is None