Request
GET /operation/data_resample_ranges/?activeElements=%7B%22resample_ranges%22:%7B%22(5)(0)Signal_1%5B%20%5D%22:%22mongodb~test_db~5-0-0-0-0
-0%22,%22(5)(0)Signal_2%5B%20%5D%22:%22mongodb~test_db~5-0-0-0-0-1%22,%22(5)(0)Signal_3%5B%20%5D%22:%22mongodb~test_db~5-0-0-0-0-2%22%7D%7D
解码
GET /operation/data_resample_ranges/?activeElements={"resample_ranges":{"(5)(0)Signal_1[ ]":"mongodb~test_db~5-0-0-0-0
-0","(5)(0)Signal_2[ ]":"mongodb~test_db~5-0-0-0-0-1","(5)(0)Signal_3[ ]":"mongodb~test_db~5-0-0-0-0-2"}}
我正在使用 unittest 编写测试,但我没有得到请求中所示的确切请求。
我的测试如下:
def test_get_saved_model_data(self):
activeElements = {
"resample_ranges": {"(5)(0)Signal_1[ ]": "mongodb~test_db~5-0-0-0-0- 0",
"(5)(0)Signal_2[]":"mongodb~test_db~5 - 0 - 0 - 0 - 0 - 1",
"(5)(0)Signal_3[]":"mongodb~test_db~5 - 0 - 0 - 0 - 0 - 2"
}
}
response = requests.get(OPERATION_API_URL, json.dumps(activeElements))
如何获得确切的请求?
当我解决它时,所以想写在这里。也许以后对其他人会有所帮助。
def test_get_saved_model_data(self):
data = {
"activeElements" :json.dump( {
"resample_ranges": {"(5)(0)Signal_1[ ]": "mongodb~test_db~5-0-0-0-0- 0",
"(5)(0)Signal_2[]":"mongodb~test_db~5 - 0 - 0 - 0 - 0 - 1",
"(5)(0)Signal_3[]":"mongodb~test_db~5 - 0 - 0 - 0 - 0 - 2"
}
})
}
response = requests.get(OPERATION_API_URL, params=data)