MCPcopy Create free account
hub / github.com/hashintel/hash / properties_remove

Function properties_remove

tests/graph/integration/postgres/property_metadata.rs:639–816  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

637#[tokio::test]
638#[expect(clippy::too_many_lines)]
639async fn properties_remove() {
640 let mut database = DatabaseTestWrapper::new().await;
641 let mut api = seed(&mut database).await;
642
643 let entity = api
644 .create_entity(
645 api.account_id,
646 CreateEntityParams {
647 web_id: WebId::new(api.account_id),
648 entity_uuid: None,
649 decision_time: None,
650 entity_type_ids: HashSet::from([person_entity_type_id()]),
651 properties: PropertyObjectWithMetadata::from_parts(alice(), None)
652 .expect("could not create property with metadata object"),
653 confidence: None,
654 link_data: None,
655 draft: false,
656 policies: Vec::new(),
657 provenance: ProvidedEntityEditionProvenance {
658 actor_type: ActorType::User,
659 origin: OriginProvenance::from_empty_type(OriginType::Api),
660 sources: Vec::new(),
661 },
662 read_only: false,
663 },
664 )
665 .await
666 .expect("could not create entity");
667 let entity_id = entity.metadata.record_id.entity_id;
668
669 let interests_path: PropertyPath =
670 once(PropertyPathElement::from(interests_property_type_id())).collect();
671 let film_path = [
672 PropertyPathElement::Property(Cow::Owned(interests_property_type_id())),
673 PropertyPathElement::Property(Cow::Owned(film_property_type_id())),
674 ]
675 .into_iter()
676 .collect::<PropertyPath>();
677
678 let updated_entity = api
679 .patch_entity(
680 api.account_id,
681 PatchEntityParams {
682 entity_id,
683 decision_time: None,
684 entity_type_ids: HashSet::new(),
685 properties: vec![
686 PropertyPatchOperation::Add {
687 path: once(PropertyPathElement::from(interests_property_type_id()))
688 .collect(),
689 property: PropertyWithMetadata::Object(PropertyObjectWithMetadata {
690 value: HashMap::new(),
691 metadata: ObjectMetadata {
692 confidence: Confidence::new(0.4),
693 provenance: property_provenance_a(),
694 },
695 }),
696 },

Callers

nothing calls this directly

Calls 12

film_property_type_idFunction · 0.85
create_entityMethod · 0.80
collectMethod · 0.80
seedFunction · 0.70
person_entity_type_idFunction · 0.70
aliceFunction · 0.70
fromFunction · 0.50
PropertyEnum · 0.50
expectMethod · 0.45
into_iterMethod · 0.45
patch_entityMethod · 0.45

Tested by

no test coverage detected