2020
2121class  DummyCoreClient (BaseCoreClient ):
2222    def  all_collections (self , * args , ** kwargs ):
23-         raise   NotImplementedError 
23+         return  { "collections" : [],  "links" : []} 
2424
2525    def  get_collection (self , * args , ** kwargs ):
2626        raise  NotImplementedError 
@@ -38,48 +38,6 @@ def item_collection(self, *args, **kwargs):
3838        raise  NotImplementedError 
3939
4040
41- def  test_get_aggregations (client : TestClient ) ->  None :
42-     response  =  client .get ("/aggregations" )
43-     assert  response .is_success , response .text 
44-     assert  response .json ()["aggregations" ] ==  [
45-         {"name" : "total_count" , "data_type" : "integer" }
46-     ]
47-     assert  AggregationCollection (
48-         type = "AggregationCollection" ,
49-         aggregations = [Aggregation (** response .json ()["aggregations" ][0 ])],
50-     )
51- 
52- 
53- def  test_get_aggregate (client : TestClient ) ->  None :
54-     response  =  client .get ("/aggregate" )
55-     assert  response .is_success , response .text 
56-     assert  response .json ()["aggregations" ] ==  []
57-     assert  AggregationCollection (
58-         type = "AggregationCollection" , aggregations = response .json ()["aggregations" ]
59-     )
60- 
61- 
62- def  test_post_aggregations (client : TestClient ) ->  None :
63-     response  =  client .post ("/aggregations" )
64-     assert  response .is_success , response .text 
65-     assert  response .json ()["aggregations" ] ==  [
66-         {"name" : "total_count" , "data_type" : "integer" }
67-     ]
68-     assert  AggregationCollection (
69-         type = "AggregationCollection" ,
70-         aggregations = [Aggregation (** response .json ()["aggregations" ][0 ])],
71-     )
72- 
73- 
74- def  test_post_aggregate (client : TestClient ) ->  None :
75-     response  =  client .post ("/aggregate" , content = "{}" )
76-     assert  response .is_success , response .text 
77-     assert  response .json ()["aggregations" ] ==  []
78-     assert  AggregationCollection (
79-         type = "AggregationCollection" , aggregations = response .json ()["aggregations" ]
80-     )
81- 
82- 
8341@pytest .fixture  
8442def  client (
8543    core_client : DummyCoreClient , aggregations_client : BaseAggregationClient 
@@ -132,3 +90,40 @@ def test(query=Depends(AggregationExtensionGetRequest)):
13290        params  =  response .json ()
13391        assert  params ["collections" ] ==  ["collection1" , "collection2" ]
13492        assert  params ["aggregations" ] ==  ["prop1" , "prop2" ]
93+ 
94+ 
95+ def  test_landing (client : TestClient ) ->  None :
96+     landing  =  client .get ("/" )
97+     assert  landing .status_code  ==  200 , landing .text 
98+     assert  "Aggregate"  in  [link .get ("title" ) for  link  in  landing .json ()["links" ]]
99+     assert  "Aggregations"  in  [link .get ("title" ) for  link  in  landing .json ()["links" ]]
100+ 
101+ 
102+ def  test_get_aggregate (client : TestClient ) ->  None :
103+     response  =  client .get ("/aggregate" )
104+     assert  response .is_success , response .text 
105+     assert  response .json ()["aggregations" ] ==  []
106+     assert  AggregationCollection (
107+         type = "AggregationCollection" , aggregations = response .json ()["aggregations" ]
108+     )
109+ 
110+ 
111+ def  test_post_aggregations (client : TestClient ) ->  None :
112+     response  =  client .post ("/aggregations" )
113+     assert  response .is_success , response .text 
114+     assert  response .json ()["aggregations" ] ==  [
115+         {"name" : "total_count" , "data_type" : "integer" }
116+     ]
117+     assert  AggregationCollection (
118+         type = "AggregationCollection" ,
119+         aggregations = [Aggregation (** response .json ()["aggregations" ][0 ])],
120+     )
121+ 
122+ 
123+ def  test_post_aggregate (client : TestClient ) ->  None :
124+     response  =  client .post ("/aggregate" , content = "{}" )
125+     assert  response .is_success , response .text 
126+     assert  response .json ()["aggregations" ] ==  []
127+     assert  AggregationCollection (
128+         type = "AggregationCollection" , aggregations = response .json ()["aggregations" ]
129+     )
0 commit comments