def setUp(self) -> None: self.secret = os.urandom(32) self.dir = TemporaryDirectory() self.home = Path(self.dir.name) self.facade = Facade(self.home, self.secret, SetupPersonPortfolio().perform(PersonData(**Generate.church_data()[0])), role=Const.A_ROLE_PRIMARY, server=False )
async def test_facade(self): facade = Facade(self.home, self.secret, SetupChurchPortfolio().perform( ChurchData(**Generate.church_data()[0])), role=Const.A_ROLE_PRIMARY, server=True) self.services_server(facade) self.assertIsInstance(facade, ChurchServerFacade) self.assertIsInstance(facade.data.portfolio.entity, Church) self.assertIsInstance(facade.data.portfolio.node, Node) self.extension_type(facade) facade.close() facade = Facade(self.home, self.secret) self.assertIsInstance(facade.data.portfolio.entity, Church) self.assertIsInstance(facade.data.portfolio.node, Node) self.extension_type(facade) facade.close()
async def create_server(cls) -> "ApplicationContext": """Create a stub server.""" return await cls._setup( StubServer, SetupChurchPortfolio().perform( ChurchData(**Generate.church_data()[0]), server=StubServer.STUB_SERVER))
def create_server(cls) -> "FacadeContext": """Create a stub server.""" return cls( SetupChurchPortfolio().perform( ChurchData(**Generate.church_data()[0]), server=True), True)
async def create_server(cls) -> ApplicationContext: """Create a stub server.""" return await ApplicationContext.setup(StubServer, ChurchData(**Generate.church_data()[0]))