def test_perform(self): issuer = SetupPersonPortfolio().perform( PersonData(**Generate.person_data()[0])) owner = SetupPersonPortfolio().perform( PersonData(**Generate.person_data()[0])) with evaluate("Verified:Create") as report: verified = CreateVerifiedStatement().perform(issuer, owner) self.assertIn(verified, issuer.verified_issuer) self.assertTrue(report)
def test_validate(self): issuer = SetupPersonPortfolio().perform(PersonData(**Generate.person_data()[0])) foreign_issuer = issuer.to_portfolio() owner = SetupPersonPortfolio().perform(PersonData(**Generate.person_data()[0])) statement = CreateVerifiedStatement().perform(issuer, owner) with evaluate("Verified:Validate") as report: ValidateVerifiedStatement().validate(foreign_issuer, statement) self.assertNotIn(statement, foreign_issuer.verified_issuer) self.assertTrue(report)
def test_validate(self): issuer = SetupPersonPortfolio().perform( PersonData(**Generate.person_data()[0])) foreign_issuer = issuer.to_portfolio() owner = SetupPersonPortfolio().perform( PersonData(**Generate.person_data()[0])) statement = CreateVerifiedStatement().perform(issuer, owner) revoked = CreateRevokedStatement().perform(issuer, statement) with evaluate("Revoked:Accept") as report: AcceptRevokedStatement().validate(foreign_issuer, revoked) self.assertIn(revoked, foreign_issuer.revoked_issuer) self.assertTrue(report)
def test_perform(self): portfolio = CreatePersonEntity().perform(PersonData(**Generate.person_data()[0])) old_privkeys = copy.deepcopy(portfolio.privkeys) with evaluate("Keys:New") as report: _, privkeys = NewKeys().perform(portfolio) self.assertTrue(report) self.assertNotEqual(privkeys, old_privkeys)
def test_validate(self): portfolio = CreatePersonEntity().perform( PersonData(**Generate.person_data()[0])) foreign_portfolio = portfolio.to_portfolio() keys, _ = NewKeys().perform(portfolio) with evaluate("Person:AcceptNewKeys") as report: AcceptNewKeys().validate(foreign_portfolio, keys) self.assertTrue(report)
def test_perform(self): data = PersonData(**Generate.person_data()[0]) with evaluate("Person:Create") as report: portfolio = CreatePersonEntity().perform(data) self.assertIsNotNone(portfolio.entity) self.assertIsNotNone(portfolio.privkeys) self.assertIsNotNone(portfolio.keys) self.assertTrue(report)
def test_perform(self): first, second = Generate.person_data(2) portfolio = CreatePersonEntity().perform(PersonData(**first)) new_data(first, second, portfolio.entity.changeables()) data = PersonData(**second) with evaluate("Person:Update") as report: entity = UpdatePersonEntity().perform(portfolio, data) self.assertTrue(report)
def test_validate(self): first, second = Generate.person_data(2) portfolio = CreatePersonEntity().perform(PersonData(**first)) foreign_portfolio = copy.deepcopy(portfolio.to_portfolio()) new_data(first, second, portfolio.entity.changeables()) data = PersonData(**second) entity = UpdatePersonEntity().perform(portfolio, data) self.assertNotEqual(entity.export(), foreign_portfolio.entity.export()) with evaluate("Person:AcceptUpdated") as report: AcceptUpdatedEntity().validate(foreign_portfolio, entity) 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_perform(self): issuer = SetupPersonPortfolio().perform( PersonData(**Generate.person_data()[0])) owner = SetupPersonPortfolio().perform( PersonData(**Generate.person_data()[0])) foreign_issuer = issuer.to_portfolio() verified = CreateVerifiedStatement().perform(issuer, owner) AcceptVerifiedStatement().validate(foreign_issuer, verified) self.assertIn(verified, foreign_issuer.verified_issuer) revoked = CreateRevokedStatement().perform(issuer, verified) AcceptRevokedStatement().validate(foreign_issuer, revoked) self.assertIn(revoked, foreign_issuer.revoked_issuer) with evaluate("Revoked:Remove") as report: RemoveRevokedStatement().perform(foreign_issuer, revoked) self.assertIn(revoked, foreign_issuer.revoked_issuer) self.assertNotIn(verified, foreign_issuer.verified_issuer) self.assertTrue(report)
def test_validate(self): data = PersonData(**Generate.person_data()[0]) portfolio = CreatePersonEntity().perform(data) ext_portfolio = copy.deepcopy(portfolio) domain = CreateDomain().perform(portfolio) self.assertIsNotNone(portfolio.domain) with evaluate("Domain:Validate") as report: ValidateDomain().validate(portfolio, domain) self.assertTrue(report) self.assertIsNone(ext_portfolio.domain) with evaluate("Domain:Validate") as report: ValidateDomain().validate(ext_portfolio, domain) self.assertTrue(report)
def test_perform(self): data = PersonData(**Generate.person_data()[0]) portfolio = CreatePersonEntity().perform(data) with evaluate("Domain:Create") as report: domain = CreateDomain().perform(portfolio) self.assertIsNotNone(domain) self.assertIs(domain, portfolio.domain) self.assertTrue(report) with self.assertRaises(DomainCreateException): CreateDomain().perform(portfolio) portfolio.freeze() with self.assertRaises(FrozenPortfolioError): CreateDomain().perform(portfolio)
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 _populate_test(self): data = Generate.person_data()[0] sub = TestSubDocument( nd={ "name": data["given_name"] + " " + data["family_name"], "sig": os.urandom(random.randint(20, 30)), }) doc = TestDocument( nd={ "id": uuid.uuid4(), "ip": ipaddress.IPv4Address(os.urandom(4)), "email": str(data["given_name"] + "." + data["family_name"] + "@example.com").lower(), "docs": sub, }) return doc
def test_validate(self): data = PersonData(**Generate.person_data()[0]) portfolio = SetupPersonPortfolio().perform(data) with evaluate("Entity:Accpept") as report: AcceptEntity().validate(portfolio) self.assertTrue(report)
def test_perform(self): data = PersonData(**Generate.person_data()[0]) with evaluate("Person:Setup") as report: portfolio = SetupPersonPortfolio().perform(data) self.assertTrue(report)