Skip to content

Commit

Permalink
Merge branch 'release/0.0.15'
Browse files Browse the repository at this point in the history
  • Loading branch information
Hi-Fi committed Mar 18, 2019
2 parents c64b483 + ca80c03 commit 4b4dfcd
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 11 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ Robot Framework's library to test REST interfaces.
Library is mostly following structure of [Requests-library](https://github.com/bulkan/robotframework-requests).

* More information about this library can be found in the
[Keyword Documentation](http://central.maven.org/maven2/com/github/hi-fi/robotframework-httprequestlibrary/0.0.14/robotframework-httprequestlibrary-0.0.14.html).
[Keyword Documentation](http://central.maven.org/maven2/com/github/hi-fi/robotframework-httprequestlibrary/0.0.15/robotframework-httprequestlibrary-0.0.15.html).
* For keyword completion in RIDE you can download this
[Library Specs](http://central.maven.org/maven2/com/github/hi-fi/robotframework-httprequestlibrary/0.0.14/robotframework-httprequestlibrary-0.0.14.xml)
[Library Specs](http://central.maven.org/maven2/com/github/hi-fi/robotframework-httprequestlibrary/0.0.15/robotframework-httprequestlibrary-0.0.15.xml)
and place it in your PYTHONPATH.

Usage
Expand All @@ -20,18 +20,18 @@ your pom.xml:
<dependency>
<groupId>com.github.hi-fi</groupId>
<artifactId>robotframework-httprequestlibrary</artifactId>
<version>0.0.14</version>
<version>0.0.15</version>
</dependency>

With Gradle, library can be use by importing it as a dependency in build.gradle:

runtime('com.github.hi-fi:robotframework-httprequestlibrary:0.0.14')
runtime('com.github.hi-fi:robotframework-httprequestlibrary:0.0.15')

If you are not using any dependency management too, you can use the
[jar-with-dependencies](http://central.maven.org/maven2/com/github/hi-fi/robotframework-httprequestlibrary/0.0.14/robotframework-httprequestlibrary-0.0.14-jar-with-dependencies.jar),
[jar-with-dependencies](http://central.maven.org/maven2/com/github/hi-fi/robotframework-httprequestlibrary/0.0.15/robotframework-httprequestlibrary-0.0.15-jar-with-dependencies.jar),
which contains all required libraries. Running tests with that is done with command:

java -jar robotframework-httprequestlibrary-0.0.14-jar-with-dependencies.jar <test directory>
java -jar robotframework-httprequestlibrary-0.0.15-jar-with-dependencies.jar <test directory>

Library import in Robot tests can be done with:

Expand Down
6 changes: 2 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.github.hi-fi</groupId>
<artifactId>robotframework-httprequestlibrary</artifactId>
<version>0.0.14</version>
<version>0.0.15</version>
<packaging>jar</packaging>

<name>robotframework-httprequestlibrary</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public static Boolean isDictionary(String testedString) {
} catch (Exception e) {
logger.debug(String.format("%s is tested for being dictionary, and result is: %s", testedString,
(testedString.contains("{") && testedString.contains("}"))));
return (testedString.contains("{") && testedString.contains("}"));
return (testedString.trim().startsWith("{") && testedString.trim().endsWith("}"));
}
}

Expand Down
19 changes: 19 additions & 0 deletions src/test/robotframework/acceptance/Post.robot
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,25 @@ Post Request With No Dictionary (plain JSON)
Should Be Equal As Strings ${resp.status_code} 200
Should Be Equal As Strings ${resp.json['data'].replace('\"','"')} ${data}

Post Request With No Dictionary (plain JSON) inside array (Keycloak)
Create Session httpbin http://httpbin.org debug=True
Set Test Variable ${data} [{"id":"role-id","name":"rolename","scopeParamRequired":false,"composite":false,"clientRole":true,"containerId":"id"}]
${resp}= Post Request httpbin /post data=${data}
Log ${resp}
Should Be Equal As Strings ${resp.status_code} 200
Should Be Equal As Strings ${resp.json['data'].replace('\"','"')} ${data}

Post Request With Dictionary inside array (Keycloak)
Create Session httpbin http://httpbin.org debug=True
${testDict} Create Dictionary id=role-id name=rolename scopeParamRequired=${False} composite=${False} clientRole=${True} containerId=id
${data} Create List ${testDict}
${dataAsJson} Evaluate json.dumps(${data}) modules=json
${resp}= Post Request httpbin /post data=${data}
Log ${resp}
Should Be Equal As Strings ${resp.status_code} 200
${respAsJson} Evaluate json.dumps(${resp.json['data']}) modules=json
Should Be Equal As Strings ${respAsJson} ${dataAsJson}

Post Requests
Create Session httpbin http://httpbin.org
&{data}= Create Dictionary name=bulkan surname=evcimen
Expand Down

0 comments on commit 4b4dfcd

Please sign in to comment.