|
10 | 10 | # pylint: disable=too-many-lines
|
11 | 11 | """Unittests for REST API."""
|
12 | 12 | import io
|
| 13 | +from datetime import date |
13 | 14 |
|
14 | 15 | from flask_cors.core import ACL_ORIGIN
|
15 | 16 |
|
@@ -979,6 +980,33 @@ def test_nodes_full_type_filter(self):
|
979 | 980 | for node in response['data']['nodes']:
|
980 | 981 | self.assertIn(node['uuid'], expected_node_uuids)
|
981 | 982 |
|
| 983 | + def test_nodes_time_filters(self): |
| 984 | + """ |
| 985 | + Get the list of node filtered by time |
| 986 | + """ |
| 987 | + today = date.today().strftime('%Y-%m-%d') |
| 988 | + |
| 989 | + expected_node_uuids = [] |
| 990 | + data = self.get_dummy_data() |
| 991 | + for calc in data['calculations']: |
| 992 | + expected_node_uuids.append(calc['uuid']) |
| 993 | + |
| 994 | + # ctime filter test |
| 995 | + url = f"{self.get_url_prefix()}/nodes/?ctime={today}&full_type=\"process.calculation.calcjob.CalcJobNode.|\"" |
| 996 | + with self.app.test_client() as client: |
| 997 | + rv_obj = client.get(url) |
| 998 | + response = json.loads(rv_obj.data) |
| 999 | + for node in response['data']['nodes']: |
| 1000 | + self.assertIn(node['uuid'], expected_node_uuids) |
| 1001 | + |
| 1002 | + # mtime filter test |
| 1003 | + url = f"{self.get_url_prefix()}/nodes/?mtime={today}&full_type=\"process.calculation.calcjob.CalcJobNode.|\"" |
| 1004 | + with self.app.test_client() as client: |
| 1005 | + rv_obj = client.get(url) |
| 1006 | + response = json.loads(rv_obj.data) |
| 1007 | + for node in response['data']['nodes']: |
| 1008 | + self.assertIn(node['uuid'], expected_node_uuids) |
| 1009 | + |
982 | 1010 | ############### Structure visualization and download #############
|
983 | 1011 | def test_structure_derived_properties(self):
|
984 | 1012 | """
|
|
0 commit comments