Skip to content
This repository has been archived by the owner on Apr 10, 2019. It is now read-only.

Commit

Permalink
#150, test: fixed expectations for controllers and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
slavaschmidt committed Jun 18, 2016
1 parent 23d0527 commit 760960e
Show file tree
Hide file tree
Showing 48 changed files with 1,046 additions and 572 deletions.
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
package basic.auth.api.yaml

import scala.language.existentials

import play.api.mvc.{Action, Controller, Results}
import play.api.mvc._
import play.api.http._
import de.zalando.play.controllers._
import Results.Status

import de.zalando.play.controllers.{PlayBodyParsing, ParsingError, ResultWrapper}
import PlayBodyParsing._

import scala.util._


Expand All @@ -28,11 +27,11 @@ trait BasicAuthApiYamlBase extends Controller with PlayBodyParsing with BasicAu


val getActionConstructor = getSecureAction
def getAction[T] = (f: getActionType[T]) => getActionConstructor { request =>

def getAction[T] = (f: getActionType[T]) => getActionConstructor { request =>
val providedTypes = Seq[String]()

negotiateContent(request.acceptedTypes, providedTypes).map { getResponseMimeType =>




Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
package cross_spec_references.yaml

import scala.language.existentials

import play.api.mvc.{Action, Controller, Results}
import play.api.mvc._
import play.api.http._
import de.zalando.play.controllers._
import Results.Status

import de.zalando.play.controllers.{PlayBodyParsing, ParsingError, ResultWrapper}
import PlayBodyParsing._

import scala.util._
import de.zalando.play.controllers.ArrayWrapper
import scala.math.BigInt
Expand Down Expand Up @@ -39,15 +38,15 @@ trait Cross_spec_referencesYamlBase extends Controller with PlayBodyParsing {
import de.zalando.play.controllers.WrappedBodyParsers

val customParsers = WrappedBodyParsers.anyParser[ModelSchemaRoot]
anyParser[ModelSchemaRoot](bodyMimeType, customParsers, "Invalid ModelSchemaRoot", maxLength)
anyParser[ModelSchemaRoot](bodyMimeType, customParsers, "Invalid ModelSchemaRoot", maxLength) _
}

val postActionConstructor = Action
def postAction[T] = (f: postActionType[T]) => postActionConstructor(postParser(Seq[String]())) { request =>

def postAction[T] = (f: postActionType[T]) => postActionConstructor(BodyParsers.parse.using(postParser(Seq[String]()))) { request =>
val providedTypes = Seq[String]()

negotiateContent(request.acceptedTypes, providedTypes).map { postResponseMimeType =>

val root = request.body


Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
package echo

import scala.language.existentials

import play.api.mvc.{Action, Controller, Results}
import play.api.mvc._
import play.api.http._
import de.zalando.play.controllers._
import Results.Status

import de.zalando.play.controllers.{PlayBodyParsing, ParsingError, ResultWrapper}
import PlayBodyParsing._

import scala.util._

import de.zalando.play.controllers.PlayPathBindables
Expand All @@ -30,11 +29,11 @@ trait EchoHandlerBase extends Controller with PlayBodyParsing {


val methodActionConstructor = Action
def methodAction[T] = (f: methodActionType[T]) => methodActionConstructor { request =>

def methodAction[T] = (f: methodActionType[T]) => methodActionConstructor { request =>
val providedTypes = Seq[String]()

negotiateContent(request.acceptedTypes, providedTypes).map { methodResponseMimeType =>




Expand Down Expand Up @@ -62,11 +61,11 @@ trait EchoApiYamlBase extends Controller with PlayBodyParsing {


val postActionConstructor = Action
def postAction[T] = (f: postActionType[T]) => postActionConstructor { request =>

def postAction[T] = (f: postActionType[T]) => postActionConstructor { request =>
val providedTypes = Seq[String]()

negotiateContent(request.acceptedTypes, providedTypes).map { postResponseMimeType =>


val eitherFormParameters = FormDataParser.postParseForm(request)
eitherFormParameters match {
Expand Down Expand Up @@ -107,11 +106,11 @@ trait EchoApiYamlBase extends Controller with PlayBodyParsing {


val gettest_pathByIdActionConstructor = Action
def gettest_pathByIdAction[T] = (f: gettest_pathByIdActionType[T]) => (id: String) => gettest_pathByIdActionConstructor { request =>

def gettest_pathByIdAction[T] = (f: gettest_pathByIdActionType[T]) => (id: String) => gettest_pathByIdActionConstructor { request =>
val providedTypes = Seq[String]()

negotiateContent(request.acceptedTypes, providedTypes).map { gettest_pathByIdResponseMimeType =>




Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
package error_in_array.yaml

import scala.language.existentials

import play.api.mvc.{Action, Controller, Results}
import play.api.mvc._
import play.api.http._
import de.zalando.play.controllers._
import Results.Status

import de.zalando.play.controllers.{PlayBodyParsing, ParsingError, ResultWrapper}
import PlayBodyParsing._

import scala.util._
import de.zalando.play.controllers.ArrayWrapper
import scala.math.BigInt
Expand Down Expand Up @@ -39,15 +38,15 @@ trait Error_in_arrayYamlBase extends Controller with PlayBodyParsing {
import de.zalando.play.controllers.WrappedBodyParsers

val customParsers = WrappedBodyParsers.anyParser[ModelSchemaRoot]
anyParser[ModelSchemaRoot](bodyMimeType, customParsers, "Invalid ModelSchemaRoot", maxLength)
anyParser[ModelSchemaRoot](bodyMimeType, customParsers, "Invalid ModelSchemaRoot", maxLength) _
}

val getschemaModelActionConstructor = Action
def getschemaModelAction[T] = (f: getschemaModelActionType[T]) => getschemaModelActionConstructor(getschemaModelParser(Seq[String]())) { request =>

def getschemaModelAction[T] = (f: getschemaModelActionType[T]) => getschemaModelActionConstructor(BodyParsers.parse.using(getschemaModelParser(Seq[String]()))) { request =>
val providedTypes = Seq[String]()

negotiateContent(request.acceptedTypes, providedTypes).map { getschemaModelResponseMimeType =>

val root = request.body


Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,19 @@
package expanded

import scala.language.existentials

import play.api.mvc.{Action, Controller, Results}
import play.api.mvc._
import play.api.http._
import de.zalando.play.controllers._
import Results.Status

import de.zalando.play.controllers.{PlayBodyParsing, ParsingError, ResultWrapper}
import PlayBodyParsing._

import scala.util._
import de.zalando.play.controllers.ArrayWrapper

import de.zalando.play.controllers.PlayPathBindables



import de.zalando.play.controllers.ResponseWriters




trait Expanded_polymorphismYamlBase extends Controller with PlayBodyParsing {
Expand All @@ -31,11 +27,11 @@ trait Expanded_polymorphismYamlBase extends Controller with PlayBodyParsing {


val findPetsActionConstructor = Action
def findPetsAction[T] = (f: findPetsActionType[T]) => (tags: PetsGetTags, limit: PetsGetLimit) => findPetsActionConstructor { request =>

def findPetsAction[T] = (f: findPetsActionType[T]) => (tags: PetsGetTags, limit: PetsGetLimit) => findPetsActionConstructor { request =>
val providedTypes = Seq[String]("application/json")

negotiateContent(request.acceptedTypes, providedTypes).map { findPetsResponseMimeType =>




Expand Down Expand Up @@ -73,18 +69,17 @@ trait Expanded_polymorphismYamlBase extends Controller with PlayBodyParsing {
negotiateContent(requestType, acceptedTypes).orElse(acceptedTypes.headOption).getOrElse("application/json")
}

import de.zalando.play.controllers.WrappedBodyParsers

val customParsers = WrappedBodyParsers.anyParser[NewPet]
anyParser[NewPet](bodyMimeType, customParsers, "Invalid NewPet", maxLength)
anyParser[NewPet](bodyMimeType, customParsers, "Invalid NewPet", maxLength) _
}

val addPetActionConstructor = Action
def addPetAction[T] = (f: addPetActionType[T]) => addPetActionConstructor(addPetParser(Seq[String]("application/json"))) { request =>

def addPetAction[T] = (f: addPetActionType[T]) => addPetActionConstructor(BodyParsers.parse.using(addPetParser(Seq[String]("application/json")))) { request =>
val providedTypes = Seq[String]("application/json")

negotiateContent(request.acceptedTypes, providedTypes).map { addPetResponseMimeType =>

val pet = request.body


Expand Down Expand Up @@ -117,11 +112,11 @@ trait Expanded_polymorphismYamlBase extends Controller with PlayBodyParsing {


val deletePetActionConstructor = Action
def deletePetAction[T] = (f: deletePetActionType[T]) => (id: Long) => deletePetActionConstructor { request =>

def deletePetAction[T] = (f: deletePetActionType[T]) => (id: Long) => deletePetActionConstructor { request =>
val providedTypes = Seq[String]("application/json")

negotiateContent(request.acceptedTypes, providedTypes).map { deletePetResponseMimeType =>




Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
package form_data.yaml

import scala.language.existentials

import play.api.mvc.{Action, Controller, Results}
import play.api.mvc._
import play.api.http._
import de.zalando.play.controllers._
import Results.Status

import de.zalando.play.controllers.{PlayBodyParsing, ParsingError, ResultWrapper}
import PlayBodyParsing._

import scala.util._
import java.io.File
import scala.math.BigInt
Expand All @@ -16,9 +15,6 @@ import de.zalando.play.controllers.PlayPathBindables



import de.zalando.play.controllers.ResponseWriters




trait Form_dataYamlBase extends Controller with PlayBodyParsing {
Expand All @@ -31,11 +27,11 @@ trait Form_dataYamlBase extends Controller with PlayBodyParsing {


val postmultipartActionConstructor = Action
def postmultipartAction[T] = (f: postmultipartActionType[T]) => postmultipartActionConstructor { request =>

def postmultipartAction[T] = (f: postmultipartActionType[T]) => postmultipartActionConstructor { request =>
val providedTypes = Seq[String]("application/json")

negotiateContent(request.acceptedTypes, providedTypes).map { postmultipartResponseMimeType =>


val eitherFormParameters = FormDataParser.postmultipartParseForm(request)
eitherFormParameters match {
Expand Down Expand Up @@ -75,11 +71,11 @@ trait Form_dataYamlBase extends Controller with PlayBodyParsing {


val posturl_encodedActionConstructor = Action
def posturl_encodedAction[T] = (f: posturl_encodedActionType[T]) => posturl_encodedActionConstructor { request =>

def posturl_encodedAction[T] = (f: posturl_encodedActionType[T]) => posturl_encodedActionConstructor { request =>
val providedTypes = Seq[String]("application/json")

negotiateContent(request.acceptedTypes, providedTypes).map { posturl_encodedResponseMimeType =>


val eitherFormParameters = FormDataParser.posturl_encodedParseForm(request)
eitherFormParameters match {
Expand Down Expand Up @@ -119,11 +115,11 @@ trait Form_dataYamlBase extends Controller with PlayBodyParsing {


val postbothActionConstructor = Action
def postbothAction[T] = (f: postbothActionType[T]) => postbothActionConstructor { request =>

def postbothAction[T] = (f: postbothActionType[T]) => postbothActionConstructor { request =>
val providedTypes = Seq[String]("application/json")

negotiateContent(request.acceptedTypes, providedTypes).map { postbothResponseMimeType =>


val eitherFormParameters = FormDataParser.postbothParseForm(request)
eitherFormParameters match {
Expand Down
Loading

0 comments on commit 760960e

Please sign in to comment.