def multiple_whitelist_entries(): with get_sa_session() as session: session.query(Whitelist).delete() yield [ Whitelist.add_account(account_name="Rayquaza", status="approved_manually"), Whitelist.add_account(account_name="Deoxys", status="approved_manually"), # Not a typo, account_name repeated intentionally to check behaviour Whitelist.add_account(account_name="Deoxys", status="waiting"), Whitelist.add_account(account_name="Solgaleo", status="waiting"), Whitelist.add_account(account_name="Zacian", status="approved_manually"), ] clean_db()
def approve_account(self, account_name: str) -> bool: """ Approve user manually :param account_name: account name for approval :return: """ # Redis account = self.get_account(account_name) or {} account["status"] = WhitelistStatus.approved_manually.value self.db[account_name] = account # Postgres DBWhitelist.add_account(account_name=account_name, status=WhitelistStatus.approved_manually.value) logger.info(f"Account {account_name} approved successfully") return True
def new_whitelist_entry(): with get_sa_session() as session: session.query(Whitelist).delete() yield Whitelist.add_account(account_name="Rayquaza", status="approved_manually") clean_db()