-
Notifications
You must be signed in to change notification settings - Fork 21
feat(cts): add custom request tests #331
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 4 commits
a56fbab
f954028
7cb03cb
a874de4
cf915d5
0daa016
b0cf8eb
e3a9a36
86d1cdf
19b0aaa
4efdcd8
42ed0a5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
[ | ||
{ | ||
"method": "del", | ||
"testName": "allow del method for a custom path with minimal parameters", | ||
"parameters": { | ||
"path": "/test/minimal" | ||
}, | ||
"request": { | ||
"path": "/1/test/minimal", | ||
"method": "DELETE" | ||
} | ||
}, | ||
{ | ||
"method": "del", | ||
"testName": "allow del method for a custom path with all parameters", | ||
"parameters": { | ||
"path": "/test/all", | ||
"parameters": { | ||
"query": "parameters" | ||
}, | ||
"body": { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good point! It's not the case for the current clients, so I think our API handles it. We can still remove it if we think it shouldn't be the case There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually, other There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I know that algolia API can be non-standard sometimes but I hope they don't break the http specification at least There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe we just missed that part in the custom request implementation of the current clients There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done here: cf915d5 |
||
"body": "parameters" | ||
} | ||
}, | ||
"request": { | ||
"path": "/1/test/all", | ||
"method": "DELETE", | ||
"data": { | ||
"body": "parameters" | ||
}, | ||
"searchParams": { | ||
"query": "parameters" | ||
} | ||
} | ||
} | ||
] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
[ | ||
{ | ||
"method": "get", | ||
"testName": "allow get method for a custom path with minimal parameters", | ||
"parameters": { | ||
"path": "/test/minimal" | ||
}, | ||
"request": { | ||
"path": "/1/test/minimal", | ||
"method": "GET" | ||
} | ||
}, | ||
{ | ||
"method": "get", | ||
"testName": "allow get method for a custom path with all parameters", | ||
"parameters": { | ||
"path": "/test/all", | ||
"parameters": { | ||
"query": "parameters" | ||
} | ||
}, | ||
"request": { | ||
"path": "/1/test/all", | ||
"method": "GET", | ||
"searchParams": { | ||
"query": "parameters" | ||
} | ||
} | ||
} | ||
] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
[ | ||
{ | ||
"method": "post", | ||
"testName": "allow post method for a custom path with minimal parameters", | ||
"parameters": { | ||
"path": "/test/minimal" | ||
}, | ||
"request": { | ||
"path": "/1/test/minimal", | ||
"method": "POST" | ||
} | ||
}, | ||
{ | ||
"method": "post", | ||
"testName": "allow post method for a custom path with all parameters", | ||
"parameters": { | ||
"path": "/test/all", | ||
"parameters": { | ||
"query": "parameters" | ||
}, | ||
"body": { | ||
"body": "parameters" | ||
} | ||
}, | ||
"request": { | ||
"path": "/1/test/all", | ||
"method": "POST", | ||
"data": { | ||
"body": "parameters" | ||
}, | ||
"searchParams": { | ||
"query": "parameters" | ||
} | ||
} | ||
} | ||
] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
[ | ||
{ | ||
"method": "put", | ||
"testName": "allow put method for a custom path with minimal parameters", | ||
"parameters": { | ||
"path": "/test/minimal" | ||
}, | ||
"request": { | ||
"path": "/1/test/minimal", | ||
"method": "PUT" | ||
} | ||
}, | ||
{ | ||
"method": "put", | ||
"testName": "allow put method for a custom path with all parameters", | ||
"parameters": { | ||
"path": "/test/all", | ||
"parameters": { | ||
"query": "parameters" | ||
}, | ||
"body": { | ||
"body": "parameters" | ||
} | ||
}, | ||
"request": { | ||
"path": "/1/test/all", | ||
"method": "PUT", | ||
"data": { | ||
"body": "parameters" | ||
}, | ||
"searchParams": { | ||
"query": "parameters" | ||
} | ||
} | ||
} | ||
] |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,8 +50,8 @@ class {{client}}Tests { | |
|
||
{{#request.searchParams}} | ||
HashMap<String, String> expectedQuery = JSON.deserialize("{{#lambda.escapequotes}}{{{request.searchParams}}}{{/lambda.escapequotes}}", new TypeToken<HashMap<String, String>>() {}.getType()); | ||
List<Pair> acutalQuery = req.getQueryParams(); | ||
for (Pair p : acutalQuery) { | ||
List<Pair> actualQuery = req.getQueryParams(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. oops I have the same code here, you will merge first unfortunately :( There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. D: |
||
for (Pair p : actualQuery) { | ||
assertEquals(expectedQuery.get(p.getName()), p.getValue()); | ||
} | ||
{{/request.searchParams}} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
huge fix !