Commit 222aa449 authored by Sid Stenersen's avatar Sid Stenersen
Browse files

Update unit tests

parent 98a86cad
Pipeline #48770 passed with stages
in 10 minutes and 38 seconds
......@@ -31,6 +31,7 @@ public:
http._response_buffer = _rbuf;
http._response_len = _rbuf.size();
http._response_code = _response_code;
http._response_headers = _response_headers;
if(http.response_code() == 200) {
http._status = HTTP_STATUS::OK;
} else {
......@@ -45,6 +46,8 @@ public:
void mock_response_code(const uint64_t& code) { _response_code = code; }
void mock_response_buffer(const std::string& buff) { _rbuf = buff; }
std::unordered_map<std::string, std::string> _response_headers;
private:
uint64_t _response_code{200};
......
......@@ -63,7 +63,10 @@ TEST_F(SeismicStoreTest, seis_datasets) {
std::string ds01str{ds01.toStyledString()};
http.mock_response_buffer(ds01str);
sdsvc->dataset_get(sdpath,false);
ASSERT_THROW(sdsvc->dataset_get(sdpath, false), SDExpectedJsonException);
http._response_headers["content-type"] = "application/json";
ASSERT_NO_THROW(sdsvc->dataset_get(sdpath, false));
ASSERT_EQ(sdsvc->dataset_get(sdpath, false).get_name(), "dsx01");
ASSERT_EQ(sdsvc->dataset_register(sdpath, "txt", "", "").get_name(), "dsx01");
......@@ -72,7 +75,7 @@ TEST_F(SeismicStoreTest, seis_datasets) {
ASSERT_TRUE(sdsvc->dataset_delete(sdpath));
http.mock_response_code(404);
ASSERT_THROW(sdsvc->dataset_get(sdpath,false), SDException);
ASSERT_THROW(sdsvc->dataset_get(sdpath,false), SDExceptionSDAccessorError);
}
TEST_F(SeismicStoreTest, seismicstore_datasets_exist) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment