diff --git a/crc/api.yml b/crc/api.yml index 684cd1f3..bb4a8d40 100644 --- a/crc/api.yml +++ b/crc/api.yml @@ -1142,156 +1142,6 @@ paths: application/json: schema: $ref: "#/components/schemas/DataStore" - - - /datastore/study/get: - parameters: - - name: key - in: query - required: true - description: The key to lookup. - schema: - type: string - format: string - - name: default - in: query - required: false - description: Default Value if key doesn't exist. - schema: - type: string - format: string - - name: study_id - in: query - required: true - description: The study id we are concerned with . - schema: - type: string - format: string - get: - operationId: crc.api.data_store.study_data_get - summary: A value from the data store, or a default if provided, or None if not found. - tags: - - DataStore Script Equivalent - responses: - '200': - description: A value from the data store, or a default if provided, or None if not found. - content: - application/json: - schema: - type: string - example: "The Value" - - - /datastore/study/set: - parameters: - - name: key - in: query - required: true - description: The key to lookup. - schema: - type: string - format: string - - name: value - in: query - required: true - description: Default Value if key doesn't exist. - schema: - type: string - format: string - - name: study_id - in: query - required: true - description: The study id we are concerned with . - schema: - type: integer - format: int32 - get: - operationId: crc.api.data_store.study_data_set - summary: Creates or updates a key/value pair for a study - tags: - - DataStore Script Equivalent - responses: - '200': - description: Sets a value in the data store for a study. - content: - application/json: - schema: - $ref: "#/components/schemas/DataStoreScript" - - /datastore/user/get: - parameters: - - name: key - in: query - required: true - description: The key to lookup. - schema: - type: string - format: string - - name: default - in: query - required: false - description: Default Value if key doesn't exist. - schema: - type: string - format: string - - name: user_id - in: query - required: true - description: The study id we are concerned with . - schema: - type: string - format: string - get: - operationId: crc.api.data_store.user_data_get - summary: Provides the value for the key, or the default if not found - tags: - - DataStore Script Equivalent - responses: - '200': - description: A value from the data store, or a default if provided, or None if not found. - content: - application/json: - schema: - type: string - example: "The Value" - - - - /datastore/user/set: - parameters: - - name: key - in: query - required: true - description: The key to lookup. - schema: - type: string - format: string - - name: value - in: query - required: true - description: Default Value if key doesn't exist. - schema: - type: string - format: string - - name: user_id - in: query - required: true - description: The user id we are concerned with . - schema: - type: string - format: string - get: - operationId: crc.api.data_store.user_data_set - summary: Creates or updates a key/value pair for a user - tags: - - DataStore Script Equivalent - responses: - '200': - description: Sets a value in the data store for a study. - content: - application/json: - schema: - $ref: "#/components/schemas/DataStoreScript" components: securitySchemes: jwt: diff --git a/tests/test_datastore_api.py b/tests/test_datastore_api.py index 5f6e1c61..c9b3154a 100644 --- a/tests/test_datastore_api.py +++ b/tests/test_datastore_api.py @@ -106,16 +106,15 @@ class DataStoreTest(BaseTest): new_study = self.add_test_study_data() new_user = self.add_test_user_data() - api_response = self.app.get('/v1.0/datastore/user/get?key=%s&user_id=%s' % (new_user['key'], - new_user['user_id']), + api_response = self.app.get(f'/v1.0/datastore/user/{new_user["user_id"]}', headers=self.logged_in_headers(), content_type="application/json") self.assert_success(api_response) - d = api_response.get_data(as_text=True) - self.assertEqual(eval(d),'User Value') + d = json.loads(api_response.get_data(as_text=True)) + self.assertEqual(d[0]['value'],'User Value') - api_response = self.app.get('/v1.0/datastore/study/get?key=%s&study_id=%d' %(new_study['key'], - new_study['study_id']), + api_response = self.app.get(f'/v1.0/datastore/study/{new_study["study_id"]}', headers=self.logged_in_headers(), content_type="application/json") + self.assert_success(api_response) - d = api_response.get_data(as_text=True) - self.assertEqual(eval(d),'Some Value') + d = json.loads(api_response.get_data(as_text=True)) + self.assertEqual(d[0]['value'],'Some Value')