drop some of the test-only api endpints and rework the tests so they aren't needed
This commit is contained in:
parent
72ade3c367
commit
c62b73a539
150
crc/api.yml
150
crc/api.yml
|
@ -1142,156 +1142,6 @@ paths:
|
||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
$ref: "#/components/schemas/DataStore"
|
$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:
|
components:
|
||||||
securitySchemes:
|
securitySchemes:
|
||||||
jwt:
|
jwt:
|
||||||
|
|
|
@ -106,16 +106,15 @@ class DataStoreTest(BaseTest):
|
||||||
new_study = self.add_test_study_data()
|
new_study = self.add_test_study_data()
|
||||||
new_user = self.add_test_user_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'],
|
api_response = self.app.get(f'/v1.0/datastore/user/{new_user["user_id"]}',
|
||||||
new_user['user_id']),
|
|
||||||
headers=self.logged_in_headers(), content_type="application/json")
|
headers=self.logged_in_headers(), content_type="application/json")
|
||||||
self.assert_success(api_response)
|
self.assert_success(api_response)
|
||||||
d = api_response.get_data(as_text=True)
|
d = json.loads(api_response.get_data(as_text=True))
|
||||||
self.assertEqual(eval(d),'User Value')
|
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'],
|
api_response = self.app.get(f'/v1.0/datastore/study/{new_study["study_id"]}',
|
||||||
new_study['study_id']),
|
|
||||||
headers=self.logged_in_headers(), content_type="application/json")
|
headers=self.logged_in_headers(), content_type="application/json")
|
||||||
|
|
||||||
self.assert_success(api_response)
|
self.assert_success(api_response)
|
||||||
d = api_response.get_data(as_text=True)
|
d = json.loads(api_response.get_data(as_text=True))
|
||||||
self.assertEqual(eval(d),'Some Value')
|
self.assertEqual(d[0]['value'],'Some Value')
|
||||||
|
|
Loading…
Reference in New Issue