async def test_create_but_unknown_realm(alice_backend_sock): bad_realm_id = RealmID.new() blob = b"Initial commit." rep = await vlob_create(alice_backend_sock, bad_realm_id, VLOB_ID, blob, check_rep=False) assert rep["status"] == "not_allowed"
async def _realm_factory(backend, author, realm_id=None, now=None): realm_id = realm_id or RealmID.new() now = now or next_timestamp() certif = RealmRoleCertificateContent.build_realm_root_certif( author=author.device_id, timestamp=now, realm_id=realm_id).dump_and_sign(author.signing_key) with backend.event_bus.listen() as spy: await backend.realm.create( organization_id=author.organization_id, self_granted_role=RealmGrantedRole( realm_id=realm_id, user_id=author.user_id, certificate=certif, role=RealmRole.OWNER, granted_by=author.device_id, granted_on=now, ), ) await spy.wait_with_timeout(BackendEvent.REALM_ROLES_UPDATED) return realm_id