async def _setup(cls, app_cls, portfolio: PrivatePortfolio): """Set up stub application environment.""" secret = Generate.new_secret() tmp_dir = TemporaryDirectory() app = app_cls(Facade(Path(tmp_dir.name), secret, portfolio, Const.A_ROLE_PRIMARY, app_cls.STUB_SERVER)) return cls(tmp_dir, secret, app)
async def setup(cls, app_cls, data): """Set up stub application environment.""" secret = Generate.new_secret() tmp_dir = TemporaryDirectory() print(app_cls) app = await app_cls.create(Path(tmp_dir.name), secret, data) return cls(tmp_dir, secret, app)
def __init__(self, portfolio: PrivatePortfolio, server: bool, admin: Signer = False): self.dir = TemporaryDirectory() self.secret = Generate.new_secret() if admin: self.facade = AdminFacade.setup(admin) else: self.facade = Facade(Path(self.dir.name), self.secret, portfolio, Const.A_ROLE_PRIMARY, server)