def test_security_token_announce(chain, security_token, team_multisig, zero_address, customer, announcement, announcement_name, announcement_uri, announcement_type, announcement_hash): """Announce Announcement """ assert security_token.call().announcementsByAddress(announcement.address) == 0 security_token.transact({"from": team_multisig}).announce(announcement.address) events = security_token.events.Announced().createFilter(fromBlock=0).get_all_entries() assert len(events) == 1 e = events[0] assert security_token.call().announcementsByAddress(announcement.address) == 1 assert e["args"]["announcement"] == announcement.address assert removeNonPrintable(e["args"]["announcementName"]) == announcement_name assert removeNonPrintable(e["args"]["announcementURI"]) == announcement_uri assert e["args"]["announcementType"] == announcement_type assert e["args"]["announcementHash"] == announcement_hash
def announcement(chain, team_multisig, announcement_name, announcement_uri, announcement_type, announcement_hash) -> Contract: """Create a bogus announcement for testing""" args = [to_bytes(text=announcement_name), to_bytes(text=announcement_uri), announcement_type, announcement_hash] tx = { "from": team_multisig } contract, hash_ = chain.provider.deploy_contract('BogusAnnouncement', deploy_args=args, deploy_transaction=tx) check_gas(chain, hash_) assert removeNonPrintable(contract.call().announcementName()) == announcement_name assert removeNonPrintable(contract.call().announcementURI()) == announcement_uri assert contract.call().announcementType() == announcement_type return contract
def test_security_token_announce(chain, security_token, team_multisig, zero_address, customer, announcement, announcement_name, announcement_uri, announcement_type, announcement_hash): """Announce Announcement """ security_token.transact({ "from": team_multisig }).announce(announcement.address) events = security_token.pastEvents("Announced").get() assert len(events) == 1 e = events[0] assert e["args"]["announcement"] == announcement.address assert removeNonPrintable( e["args"]["announcementName"]) == announcement_name assert removeNonPrintable(e["args"]["announcementURI"]) == announcement_uri assert e["args"]["announcementType"] == announcement_type assert e["args"]["announcementHash"] == announcement_hash