-
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 all 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 |
---|---|---|
@@ -1 +1 @@ | ||
7.2.0 | ||
7.2.1.0.1 |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -170,6 +170,9 @@ public Map<String, Object> postProcessSupportingFileData( | |
System.out.println(e.getMessage()); | ||
System.exit(0); | ||
} | ||
|
||
System.out.println(e.getMessage()); | ||
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. huge fix ! |
||
System.exit(1); | ||
} catch (Exception e) { | ||
e.printStackTrace(); | ||
System.exit(1); | ||
|
@@ -181,15 +184,28 @@ private Map<String, Request[]> loadCTS() | |
throws JsonParseException, JsonMappingException, IOException, CTSException { | ||
TreeMap<String, Request[]> cts = new TreeMap<>(); | ||
File dir = new File("tests/CTS/methods/requests/" + client); | ||
File commonTestDir = new File("tests/CTS/methods/requests/common"); | ||
if (!dir.exists()) { | ||
throw new CTSException("CTS not found at " + dir.getAbsolutePath(), true); | ||
} | ||
if (!commonTestDir.exists()) { | ||
throw new CTSException( | ||
"CTS not found at " + commonTestDir.getAbsolutePath(), | ||
true | ||
); | ||
} | ||
for (File f : dir.listFiles()) { | ||
cts.put( | ||
f.getName().replace(".json", ""), | ||
Json.mapper().readValue(f, Request[].class) | ||
); | ||
} | ||
for (File f : commonTestDir.listFiles()) { | ||
cts.put( | ||
f.getName().replace(".json", ""), | ||
Json.mapper().readValue(f, Request[].class) | ||
); | ||
} | ||
return cts; | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
[ | ||
{ | ||
"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" | ||
} | ||
}, | ||
"request": { | ||
"path": "/1/test/all", | ||
"method": "DELETE", | ||
"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.
How is that making a difference ? Those files aren't pushed
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.
Yet they are not, but required by the cache, I wonder if it will work
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.
An other limitation of the cache :( We will need to add it afterward