Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
ARSnova Scala Prototype
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
16
Issues
16
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ARSnova
ARSnova Scala Prototype
Commits
d4c2aefd
Commit
d4c2aefd
authored
Oct 31, 2016
by
Tom Käsler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add features api spec
parent
8b6dcea5
Pipeline
#5218
passed with stage
in 1 minute and 19 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
55 additions
and
7 deletions
+55
-7
src/test/scala/BaseServiceSpec.scala
src/test/scala/BaseServiceSpec.scala
+2
-1
src/test/scala/FeatureApiSpec.scala
src/test/scala/FeatureApiSpec.scala
+0
-6
src/test/scala/FeaturesApiSpec.scala
src/test/scala/FeaturesApiSpec.scala
+53
-0
No files found.
src/test/scala/BaseServiceSpec.scala
View file @
d4c2aefd
...
@@ -13,7 +13,8 @@ import org.scalatest.BeforeAndAfterEach
...
@@ -13,7 +13,8 @@ import org.scalatest.BeforeAndAfterEach
import
utils.DatabaseConfig
import
utils.DatabaseConfig
class
BaseServiceSpec
extends
FunSpec
with
Matchers
with
MigrationConfig
with
BeforeAndAfterAll
with
DatabaseConfig
class
BaseServiceSpec
extends
FunSpec
with
Matchers
with
MigrationConfig
with
BeforeAndAfterAll
with
DatabaseConfig
with
BaseService
with
SessionApiSpec
with
QuestionApiSpec
with
FreetextAnswerApiSpec
with
ChoiceAnswerApiSpec
with
CommentApiSpec
with
TestData
{
with
BaseService
with
SessionApiSpec
with
QuestionApiSpec
with
FreetextAnswerApiSpec
with
ChoiceAnswerApiSpec
with
CommentApiSpec
with
FeaturesApiSpec
with
TestData
{
protected
val
log
:
LoggingAdapter
=
NoLogging
protected
val
log
:
LoggingAdapter
=
NoLogging
import
driver.api._
import
driver.api._
...
...
src/test/scala/FeatureApiSpec.scala
deleted
100644 → 0
View file @
8b6dcea5
/**
* Created by tekay on 31.10.16.
*/
class
FeatureApiSpec
{
}
src/test/scala/FeaturesApiSpec.scala
0 → 100644
View file @
d4c2aefd
import
akka.http.scaladsl.testkit.ScalatestRouteTest
import
org.scalatest.
{
FunSpec
,
Matchers
}
import
org.scalatest.concurrent.ScalaFutures
import
services.BaseService
import
models._
import
services.FeaturesService
import
spray.json._
import
akka.http.scaladsl.marshallers.sprayjson.SprayJsonSupport._
import
akka.http.scaladsl.model.
{
HttpEntity
,
MediaTypes
}
import
akka.http.scaladsl.model.StatusCodes._
trait
FeaturesApiSpec
extends
FunSpec
with
Matchers
with
ScalaFutures
with
BaseService
with
ScalatestRouteTest
with
Routes
with
TestData
{
import
mappings.FeatureJsonProtocol._
describe
(
"Features api"
)
{
it
(
"retrieve features by id"
)
{
Get
(
"/features/1"
)
~>
featuresApi
~>
check
{
responseAs
[
JsObject
]
should
be
(
testFeatures
.
head
.
toJson
)
}
}
it
(
"retrieve features for session 1"
)
{
Get
(
"/session/1/features"
)
~>
featuresApi
~>
check
{
responseAs
[
JsObject
]
should
be
(
testFeatures
.
head
.
toJson
)
}
}
it
(
"create features"
)
{
val
postFeature
=
Features
(
None
,
4
,
true
,
true
,
false
,
false
,
true
,
true
,
false
,
false
,
true
,
true
)
val
requestEntity
=
HttpEntity
(
MediaTypes
.
`application/json`
,
postFeature
.
toJson
.
toString
)
Post
(
"/features/"
,
requestEntity
)
~>
featuresApi
~>
check
{
response
.
status
should
be
(
OK
)
}
}
it
(
"update features"
)
{
val
feature
=
testFeatures
.
head
val
putFeature
=
feature
.
copy
(
flashcards
=
false
,
jitt
=
false
)
val
requestEntity
=
HttpEntity
(
MediaTypes
.
`application/json`
,
putFeature
.
toJson
.
toString
)
Put
(
"/features/"
+
putFeature
.
id
.
get
,
requestEntity
)
~>
featuresApi
~>
check
{
response
.
status
should
be
(
OK
)
Get
(
"/features/"
+
putFeature
.
id
.
get
)
~>
featuresApi
~>
check
{
responseAs
[
Features
]
should
be
(
putFeature
)
}
}
}
it
(
"delete features"
)
{
val
featureId
=
testFeatures
.
head
.
id
.
get
Delete
(
"/features/"
+
featureId
)
~>
featuresApi
~>
check
{
response
.
status
should
be
(
OK
)
Get
(
"/features/"
+
featureId
)
~>
featuresApi
~>
check
{
response
.
status
should
be
(
NotFound
)
}
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment