mirror of
https://github.com/OpenBankProject/API-Explorer.git
synced 2026-02-06 10:47:23 +00:00
uncommented the test file
This commit is contained in:
parent
8c8611dac6
commit
1d3d4d4534
@ -63,6 +63,11 @@
|
||||
<artifactId>dispatch-oauth_${scala.version}</artifactId>
|
||||
<version>0.8.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.databinder</groupId>
|
||||
<artifactId>dispatch-lift-json_${scala.version}</artifactId>
|
||||
<version>0.8.5</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ch.qos.logback</groupId>
|
||||
<artifactId>logback-classic</artifactId>
|
||||
@ -141,9 +146,27 @@
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<sourceDirectory>src/main</sourceDirectory>
|
||||
<sourceDirectory>src/main/scala</sourceDirectory>
|
||||
<testSourceDirectory>src/test/scala</testSourceDirectory>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<!-- add src/main/java to source dirs -->
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>build-helper-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>generate-sources</phase>
|
||||
<goals>
|
||||
<goal>add-source</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<sources>
|
||||
<source>src/main/java</source>
|
||||
</sources>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.scala-tools</groupId>
|
||||
<artifactId>maven-scala-plugin</artifactId>
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/*package code.api
|
||||
package code.api
|
||||
|
||||
import org.scalatest._
|
||||
import org.scalatest.FeatureSpec
|
||||
@ -26,13 +26,13 @@ case class APIResponse(code: Int, body: JValue)
|
||||
|
||||
|
||||
@RunWith(classOf[JUnitRunner])
|
||||
class API1_1Tests extends FeatureSpec
|
||||
with BeforeAndAfter with GivenWhenThen
|
||||
class API1_1Tests extends FeatureSpec
|
||||
with BeforeAndAfter with GivenWhenThen
|
||||
with ShouldMatchers with BeforeAndAfterAll {
|
||||
|
||||
*//**
|
||||
/**
|
||||
* test server settings
|
||||
*//*
|
||||
*/
|
||||
val host = "localhost"
|
||||
val port = 8000
|
||||
val server = new Server
|
||||
@ -52,23 +52,23 @@ class API1_1Tests extends FeatureSpec
|
||||
val baseRequest = (:/(host, Integer.valueOf(port)))
|
||||
val v1_1Request = baseRequest / "obp" / "1.1"
|
||||
|
||||
*//**
|
||||
/**
|
||||
* the methods lunched before all the tests
|
||||
*//*
|
||||
*/
|
||||
override def beforeAll() {
|
||||
server.start()
|
||||
}
|
||||
|
||||
*//**
|
||||
/**
|
||||
* the methods lunched after all the tests
|
||||
*//*
|
||||
*/
|
||||
override def afterAll() {
|
||||
server.stop()
|
||||
}
|
||||
|
||||
*//**
|
||||
* this method do a post request given a URL, a JSON and an optional Headers Map
|
||||
*//*
|
||||
/**
|
||||
this method do a post request given a URL, a JSON and an optional Headers Map
|
||||
*/
|
||||
def makePostRequest(req: Request, json: String, headers : Map[String,String] = Map()) : h.HttpPackage[APIResponse] = {
|
||||
val jsonReq = req << (json, "application/json") <:< headers
|
||||
val jsonHandler = jsonReq ># {json => json}
|
||||
@ -78,16 +78,16 @@ class API1_1Tests extends FeatureSpec
|
||||
}
|
||||
|
||||
def makePutRequest(req: Request, json: String, headers : Map[String,String] = Map()) : h.HttpPackage[APIResponse] = {
|
||||
val jsonReq = req <<< json <:< headers
|
||||
val jsonReq = req <<< json <:< headers
|
||||
val jsonHandler = jsonReq ># {json => json}
|
||||
h x jsonHandler{
|
||||
case (code, _, _, json) => APIResponse(code, json())
|
||||
}
|
||||
}
|
||||
|
||||
*//**
|
||||
* this method do a post request given a URL
|
||||
*//*
|
||||
/**
|
||||
* this method do a post request given a URL
|
||||
*/
|
||||
def makeGetRequest(req: Request, headers : Map[String,String] = Map()) : h.HttpPackage[APIResponse] = {
|
||||
val jsonReq = req <:< headers
|
||||
val jsonHandler = jsonReq ># {json => json}
|
||||
@ -95,23 +95,23 @@ class API1_1Tests extends FeatureSpec
|
||||
case (code, _, _, json) => APIResponse(code, json())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
def getAPIInfo = {
|
||||
val request = v1_1Request / "azezae"
|
||||
val request = v1_1Request
|
||||
makeGetRequest(request)
|
||||
}
|
||||
|
||||
*//************************ the tests ************************//*
|
||||
/************************ the tests ************************/
|
||||
feature("base line URL works"){
|
||||
|
||||
|
||||
scenario("we get the api information") {
|
||||
Given("The user is not logged in")
|
||||
When("the request is sent")
|
||||
println("Hello !! this is a test")
|
||||
val reply = getAPIInfo
|
||||
Then("we should get a 200 created code")
|
||||
reply.code should equal (200)
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user