def test_validate(self): portfolio = CreateChurchEntity().perform(ChurchData(**Generate.church_data()[0])) CreateDomain().perform(portfolio) CreateNode().current(portfolio, server=True) foreign_porfolio = portfolio.to_portfolio() self.assertIsNone(foreign_porfolio.network) network = CreateNetwork().perform(portfolio) AcceptNetwork().validate(foreign_porfolio, network) CreateNode().perform(portfolio, device="test", serial="1234567890", ip=IPv4Address("127.0.0.1"), server=True) network = UpdateNetwork().perform(portfolio) with evaluate("Network:Validate") as report: ValidateNetwork().validate(foreign_porfolio, network) self.assertIs(network, foreign_porfolio.network) self.assertTrue(report)
def test_current(self): data = PersonData(**Generate.person_data()[0]) portfolio = CreatePersonEntity().perform(data) with self.assertRaises(NodeCreateException): CreateNode().current(portfolio, server=True) CreateDomain().perform(portfolio) with evaluate("Node:Create") as report: node = CreateNode().current(portfolio, server=True) self.assertIsNotNone(node) self.assertIn(node, portfolio.nodes) self.assertTrue(report) portfolio.freeze() with self.assertRaises(FrozenPortfolioError): CreateNode().current(portfolio, server=True)
def test_perform(self): portfolio = CreateChurchEntity().perform( ChurchData(**Generate.church_data()[0])) domain = CreateDomain().perform(portfolio) CreateNode().current(portfolio, server=True) CreateNetwork().perform(portfolio) CreateNode().perform(portfolio, device="test", serial="1234567890", ip=IPv4Address("127.0.0.1"), server=True) with evaluate("Network:Update") as report: network = UpdateNetwork().perform(portfolio) self.assertIs(network, portfolio.network) self.assertEqual(network.domain, domain.id) self.assertEqual(len(network.hosts), 2) self.assertTrue(report)
def test_perform(self): data = ChurchData(**Generate.church_data()[0]) portfolio = CreateChurchEntity().perform(data) domain = CreateDomain().perform(portfolio) CreateNode().current(portfolio, server=True) with evaluate("Network:Create") as report: network = CreateNetwork().perform(portfolio) self.assertIs(network, portfolio.network) self.assertEqual(network.domain, domain.id) self.assertEqual(len(network.hosts), 1) self.assertTrue(report)
def test_perform(self): data = PersonData(**Generate.person_data()[0]) portfolio = CreatePersonEntity().perform(data) CreateDomain().perform(portfolio) node = CreateNode().current(portfolio, server=True) self.assertIn(node, portfolio.nodes) with evaluate("Node:Validate") as report: ValidateNode().validate(portfolio, node) self.assertIn(node, portfolio.nodes) self.assertTrue(report)
def test_validate(self): portfolio = CreateChurchEntity().perform(ChurchData(**Generate.church_data()[0])) CreateDomain().perform(portfolio) CreateNode().current(portfolio, server=True) foreign_porfolio = portfolio.to_portfolio() self.assertIsNone(foreign_porfolio.network) network = CreateNetwork().perform(portfolio) with evaluate("Network:Accept") as report: AcceptNetwork().validate(foreign_porfolio, network) self.assertIs(network, foreign_porfolio.network) self.assertTrue(report)