5252 CustomUUIDItemAttributesSchema ,
5353 PostAttributesBaseSchema ,
5454 PostCommentAttributesBaseSchema ,
55+ SelfRelationshipAttributesSchema ,
5556 SelfRelationshipSchema ,
5657 UserAttributesBaseSchema ,
5758 UserBioAttributesBaseSchema ,
@@ -1845,10 +1846,12 @@ async def test_remove_to_one_relationship_using_by_update(self, async_session: A
18451846 assert child_obj .self_relationship_id == parent_obj .id
18461847
18471848 async with AsyncClient (app = app , base_url = "http://test" ) as client :
1849+ expected_name = fake .name ()
18481850 update_body = {
18491851 "data" : {
1852+ "id" : str (child_obj .id ),
18501853 "attributes" : {
1851- "name" : fake . name () ,
1854+ "name" : expected_name ,
18521855 },
18531856 "relationships" : {
18541857 "self_relationship" : {
@@ -1857,9 +1860,23 @@ async def test_remove_to_one_relationship_using_by_update(self, async_session: A
18571860 },
18581861 },
18591862 }
1863+ params = {
1864+ "include" : "self_relationship" ,
1865+ }
18601866 url = app .url_path_for (f"update_{ resource_type } _detail" , obj_id = child_obj .id )
1861- res = await client .patch (url , json = update_body )
1867+ res = await client .patch (url , params = params , json = update_body )
18621868 assert res .status_code == status .HTTP_200_OK , res .text
1869+ assert res .json () == {
1870+ "data" : {
1871+ "attributes" : SelfRelationshipAttributesSchema (name = expected_name ).dict (),
1872+ "id" : str (child_obj .id ),
1873+ "relationships" : {"self_relationship" : {"data" : None }},
1874+ "type" : "self_relationship" ,
1875+ },
1876+ "included" : [],
1877+ "jsonapi" : {"version" : "1.0" },
1878+ "meta" : None ,
1879+ }
18631880
18641881 await async_session .refresh (child_obj )
18651882 assert child_obj .self_relationship_id is None
0 commit comments