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

Commit

Permalink
#3, test: Fixed outdated expected results
Browse files Browse the repository at this point in the history
  • Loading branch information
slavaschmidt committed Mar 7, 2016
1 parent cb84bbb commit 2c97099
Show file tree
Hide file tree
Showing 12 changed files with 65 additions and 49 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {{import.name}}

{{for controller in controllers}}

trait {{controller.base}} extends Controller with PlayBodyParsing {
trait {{controller.base}} extends Controller with PlayBodyParsing {{if controller.security_trait}} with {{controller.security_trait}} {{/if}}{
{{for m in controller.methods}}
private type {{m.action_request_type}} = ({{for v in m.validations}}{{for f in v.fields}}{{f.type_name}}{{if f.isNotLast}}, {{/if}}{{/for}}{{/for}}{{if m.has_no_validations}}Unit{{/if}})
private type {{m.action_type}} = {{m.action_request_type}} => Try[(Int, Any)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import {{import.name}}
{{for controller in controllers}}

trait {{controller.security_trait}} {
val unauthorizedContent = ???
val mimeType: String = ???
{{for m in controller.methods}}
{{if m.needs_security}}
{{for security_check in m.security_checks}}
Expand All @@ -18,7 +20,7 @@ trait {{controller.security_trait}} {

val {{m.secure_checks}} = Seq({{for security_check in m.security_checks}}{{security_check.name}} _{{if security_check.isNotLast}}, {{/if}}{{/for}})

class {{m.secure_action}}(mimeType: String, unauthorizedContent: Any) extends AuthenticatedBuilder(
object {{m.secure_action}} extends AuthenticatedBuilder(
req => {
val individualChecks = {{m.secure_checks}}.map(_.apply(req))
individualChecks.find(_.isEmpty).getOrElse(Option(individualChecks.flatten))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ import scala.util._



trait BasicAuthApiYamlBase extends Controller with PlayBodyParsing {

trait BasicAuthApiYamlBase extends Controller with PlayBodyParsing with BasicAuthApiYamlSecurity {
private type getActionRequestType = (Unit)
private type getActionType = getActionRequestType => Try[(Int, Any)]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ import de.zalando.play.controllers.PlayPathBindables



trait FullPetstoreApiYamlBase extends Controller with PlayBodyParsing {

trait FullPetstoreApiYamlBase extends Controller with PlayBodyParsing with FullPetstoreApiYamlSecurity {
private type findPetsByTagsActionRequestType = (PetsFindByStatusGetStatus)
private type findPetsByTagsActionType = findPetsByTagsActionRequestType => Try[(Int, Any)]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ import de.zalando.play.controllers.PlayPathBindables



trait InstagramApiYamlBase extends Controller with PlayBodyParsing {

trait InstagramApiYamlBase extends Controller with PlayBodyParsing with InstagramApiYamlSecurity {
private type getmediaByMedia_idLikesActionRequestType = (Int)
private type getmediaByMedia_idLikesActionType = getmediaByMedia_idLikesActionRequestType => Try[(Int, Any)]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ import de.zalando.play.controllers.PlayPathBindables



trait SecurityApiYamlBase extends Controller with PlayBodyParsing {

trait SecurityApiYamlBase extends Controller with PlayBodyParsing with SecurityApiYamlSecurity {
private type getPetsByIdActionRequestType = (PetsIdGetId)
private type getPetsByIdActionType = getPetsByIdActionRequestType => Try[(Int, Any)]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import de.zalando.play.controllers.PlayPathBindables



trait SplitPetstoreApiYamlBase extends Controller with PlayBodyParsing {
trait SplitPetstoreApiYamlBase extends Controller with PlayBodyParsing with SplitPetstoreApiYamlSecurity {
private type findPetsByTagsActionRequestType = (PetsFindByStatusGetStatus)
private type findPetsByTagsActionType = findPetsByTagsActionRequestType => Try[(Int, Any)]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@ import de.zalando.play.controllers.PlayBodyParsing


trait BasicAuthApiYamlSecurity {
val unauthorizedContent = ???
val mimeType: String = ???

def basicAuth_Extractor[User >: Any](header: RequestHeader): Option[User] = ???

val basicAuth_Checks = Seq(basicAuth_Extractor _)

class basicAuth_Action(mimeType: String, unauthorizedContent: Any) extends AuthenticatedBuilder(
object basicAuth_Action extends AuthenticatedBuilder(
req => {
val individualChecks = basicAuth_Checks.map(_.apply(req))
individualChecks.find(_.isEmpty).getOrElse(Option(individualChecks.flatten))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@ import org.joda.time.DateTime


trait FullPetstoreApiYamlSecurity {
val unauthorizedContent = ???
val mimeType: String = ???

def petstore_auth_Extractor[User >: Any](header: RequestHeader): Option[User] = ???

val petstore_auth_Checks = Seq(petstore_auth_Extractor _)

class petstore_auth_Action(mimeType: String, unauthorizedContent: Any) extends AuthenticatedBuilder(
object petstore_auth_Action extends AuthenticatedBuilder(
req => {
val individualChecks = petstore_auth_Checks.map(_.apply(req))
individualChecks.find(_.isEmpty).getOrElse(Option(individualChecks.flatten))
Expand All @@ -32,7 +34,7 @@ trait FullPetstoreApiYamlSecurity {

val petstore_auth_Checks = Seq(petstore_auth_Extractor _)

class petstore_auth_Action(mimeType: String, unauthorizedContent: Any) extends AuthenticatedBuilder(
object petstore_auth_Action extends AuthenticatedBuilder(
req => {
val individualChecks = petstore_auth_Checks.map(_.apply(req))
individualChecks.find(_.isEmpty).getOrElse(Option(individualChecks.flatten))
Expand All @@ -45,7 +47,7 @@ trait FullPetstoreApiYamlSecurity {

val petstore_auth_Checks = Seq(petstore_auth_Extractor _)

class petstore_auth_Action(mimeType: String, unauthorizedContent: Any) extends AuthenticatedBuilder(
object petstore_auth_Action extends AuthenticatedBuilder(
req => {
val individualChecks = petstore_auth_Checks.map(_.apply(req))
individualChecks.find(_.isEmpty).getOrElse(Option(individualChecks.flatten))
Expand All @@ -63,7 +65,7 @@ trait FullPetstoreApiYamlSecurity {

val api_key_petstore_auth_Checks = Seq(api_key_Extractor _, petstore_auth_Extractor _)

class api_key_petstore_auth_Action(mimeType: String, unauthorizedContent: Any) extends AuthenticatedBuilder(
object api_key_petstore_auth_Action extends AuthenticatedBuilder(
req => {
val individualChecks = api_key_petstore_auth_Checks.map(_.apply(req))
individualChecks.find(_.isEmpty).getOrElse(Option(individualChecks.flatten))
Expand All @@ -76,7 +78,7 @@ trait FullPetstoreApiYamlSecurity {

val petstore_auth_Checks = Seq(petstore_auth_Extractor _)

class petstore_auth_Action(mimeType: String, unauthorizedContent: Any) extends AuthenticatedBuilder(
object petstore_auth_Action extends AuthenticatedBuilder(
req => {
val individualChecks = petstore_auth_Checks.map(_.apply(req))
individualChecks.find(_.isEmpty).getOrElse(Option(individualChecks.flatten))
Expand All @@ -89,7 +91,7 @@ trait FullPetstoreApiYamlSecurity {

val petstore_auth_Checks = Seq(petstore_auth_Extractor _)

class petstore_auth_Action(mimeType: String, unauthorizedContent: Any) extends AuthenticatedBuilder(
object petstore_auth_Action extends AuthenticatedBuilder(
req => {
val individualChecks = petstore_auth_Checks.map(_.apply(req))
individualChecks.find(_.isEmpty).getOrElse(Option(individualChecks.flatten))
Expand All @@ -102,7 +104,7 @@ trait FullPetstoreApiYamlSecurity {

val petstore_auth_Checks = Seq(petstore_auth_Extractor _)

class petstore_auth_Action(mimeType: String, unauthorizedContent: Any) extends AuthenticatedBuilder(
object petstore_auth_Action extends AuthenticatedBuilder(
req => {
val individualChecks = petstore_auth_Checks.map(_.apply(req))
individualChecks.find(_.isEmpty).getOrElse(Option(individualChecks.flatten))
Expand Down
Loading

0 comments on commit 2c97099

Please sign in to comment.