@@ -981,10 +981,10 @@ async def test_query_data_generic_fragment(clients, mock_schema_query_02, client
981
981
async def test_query_data_include_property (client , location_schema : NodeSchemaAPI , client_type ):
982
982
if client_type == "standard" :
983
983
node = InfrahubNode (client = client , schema = location_schema )
984
- data = await node .generate_query_data (include = ["tags" ], property = True )
984
+ data = await node .generate_query_data (include = ["name" , "type" , " tags" ], property = True )
985
985
else :
986
986
node = InfrahubNodeSync (client = client , schema = location_schema )
987
- data = node .generate_query_data (include = ["tags" ], property = True )
987
+ data = node .generate_query_data (include = ["name" , "type" , " tags" ], property = True )
988
988
989
989
assert data == {
990
990
"BuiltinLocation" : {
@@ -1013,23 +1013,6 @@ async def test_query_data_include_property(client, location_schema: NodeSchemaAP
1013
1013
},
1014
1014
"value" : None ,
1015
1015
},
1016
- "description" : {
1017
- "is_default" : None ,
1018
- "is_from_profile" : None ,
1019
- "is_protected" : None ,
1020
- "is_visible" : None ,
1021
- "owner" : {
1022
- "__typename" : None ,
1023
- "display_label" : None ,
1024
- "id" : None ,
1025
- },
1026
- "source" : {
1027
- "__typename" : None ,
1028
- "display_label" : None ,
1029
- "id" : None ,
1030
- },
1031
- "value" : None ,
1032
- },
1033
1016
"type" : {
1034
1017
"is_default" : None ,
1035
1018
"is_from_profile" : None ,
@@ -1047,28 +1030,6 @@ async def test_query_data_include_property(client, location_schema: NodeSchemaAP
1047
1030
},
1048
1031
"value" : None ,
1049
1032
},
1050
- "primary_tag" : {
1051
- "properties" : {
1052
- "is_protected" : None ,
1053
- "is_visible" : None ,
1054
- "owner" : {
1055
- "__typename" : None ,
1056
- "display_label" : None ,
1057
- "id" : None ,
1058
- },
1059
- "source" : {
1060
- "__typename" : None ,
1061
- "display_label" : None ,
1062
- "id" : None ,
1063
- },
1064
- },
1065
- "node" : {
1066
- "id" : None ,
1067
- "hfid" : None ,
1068
- "display_label" : None ,
1069
- "__typename" : None ,
1070
- },
1071
- },
1072
1033
"tags" : {
1073
1034
"count" : None ,
1074
1035
"edges" : {
@@ -1103,10 +1064,10 @@ async def test_query_data_include_property(client, location_schema: NodeSchemaAP
1103
1064
async def test_query_data_include (client , location_schema : NodeSchemaAPI , client_type ):
1104
1065
if client_type == "standard" :
1105
1066
node = InfrahubNode (client = client , schema = location_schema )
1106
- data = await node .generate_query_data (include = ["tags" ])
1067
+ data = await node .generate_query_data (include = ["name" , "type" , " tags" ])
1107
1068
else :
1108
1069
node = InfrahubNodeSync (client = client , schema = location_schema )
1109
- data = node .generate_query_data (include = ["tags" ])
1070
+ data = node .generate_query_data (include = ["name" , "type" , " tags" ])
1110
1071
1111
1072
assert data == {
1112
1073
"BuiltinLocation" : {
@@ -1121,20 +1082,9 @@ async def test_query_data_include(client, location_schema: NodeSchemaAPI, client
1121
1082
"name" : {
1122
1083
"value" : None ,
1123
1084
},
1124
- "description" : {
1125
- "value" : None ,
1126
- },
1127
1085
"type" : {
1128
1086
"value" : None ,
1129
1087
},
1130
- "primary_tag" : {
1131
- "node" : {
1132
- "id" : None ,
1133
- "hfid" : None ,
1134
- "display_label" : None ,
1135
- "__typename" : None ,
1136
- },
1137
- },
1138
1088
"tags" : {
1139
1089
"count" : None ,
1140
1090
"edges" : {
@@ -1241,6 +1191,21 @@ async def test_query_data_exclude(client, location_schema: NodeSchemaAPI, client
1241
1191
}
1242
1192
1243
1193
1194
+ @pytest .mark .parametrize ("client_type" , client_types )
1195
+ async def test_query_data_include_exclude (client , location_schema : NodeSchemaAPI , client_type ):
1196
+ if client_type == "standard" :
1197
+ node = InfrahubNode (client = client , schema = location_schema )
1198
+
1199
+ with pytest .raises (ValueError ) as exc :
1200
+ await node .generate_query_data (include = ["name" , "type" ], exclude = ["description" ], property = True )
1201
+ assert "include and exclude are exclusive" in str (exc .value )
1202
+ else :
1203
+ node = InfrahubNodeSync (client = client , schema = location_schema )
1204
+ with pytest .raises (ValueError ) as exc :
1205
+ node .generate_query_data (include = ["name" , "type" , "tags" ], exclude = ["description" ], property = True )
1206
+ assert "include and exclude are exclusive" in str (exc .value )
1207
+
1208
+
1244
1209
@pytest .mark .parametrize ("client_type" , client_types )
1245
1210
async def test_create_input_data (client , location_schema : NodeSchemaAPI , client_type ):
1246
1211
data = {"name" : {"value" : "JFK1" }, "description" : {"value" : "JFK Airport" }, "type" : {"value" : "SITE" }}
0 commit comments