Skip to content

Commit

Permalink
Fix tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
s-ludwig committed Aug 11, 2015
1 parent 88471a1 commit 4166944
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions source/vibe/web/rest.d
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ unittest {
restsettings.baseURL = URL("http://api.example.org/");

auto router = new URLRouter;
router.get("/myapi.js", serveRestJSClient!MyAPI());
router.get("/myapi.js", serveRestJSClient!MyAPI(restsettings));
//router.get("/", staticTemplate!"index.dt");

listenHTTP(new HTTPServerSettings, router);
Expand Down Expand Up @@ -1283,15 +1283,15 @@ body {

// Test detection of user typos (e.g., if the attribute is on a parameter that doesn't exist).
unittest {
enum msg = "No parameter 'ath' (referenced by attribute @HeaderParam)";
enum msg = "No parameter 'ath' (referenced by attribute @headerParam)";

interface ITypo {
@headerParam("ath", "Authorization") // mistyped parameter name
string getResponse(string auth);
}
enum err = getInterfaceValidationError!ITypo;
static assert(err !is null && stripTestIdent(err) == msg,
"Expected validation error for getResponse, got "~err);
"Expected validation error for getResponse, got: "~stripTestIdent(err));
}

// Multiple origin for a parameter
Expand Down Expand Up @@ -1388,28 +1388,28 @@ unittest {
string getData(ref string auth);
}
static assert(stripTestIdent(getInterfaceValidationError!QueryRef)
== "Query parameter 'auth' cannot be ref");
== "query parameter 'auth' cannot be ref");

interface QueryOut {
@queryParam("auth", "auth")
void getData(out string auth);
}
static assert(stripTestIdent(getInterfaceValidationError!QueryOut)
== "Query parameter 'auth' cannot be out");
== "query parameter 'auth' cannot be out");

interface BodyRef {
@bodyParam("auth", "auth")
string getData(ref string auth);
}
static assert(stripTestIdent(getInterfaceValidationError!BodyRef)
== "Body parameter 'auth' cannot be ref");
== "body_ parameter 'auth' cannot be ref");

interface BodyOut {
@bodyParam("auth", "auth")
void getData(out string auth);
}
static assert(stripTestIdent(getInterfaceValidationError!BodyOut)
== "Body parameter 'auth' cannot be out");
== "body_ parameter 'auth' cannot be out");

// There's also the possibility of someone using an out unnamed
// parameter (don't ask me why), but this is catched as unnamed
Expand Down Expand Up @@ -1478,6 +1478,7 @@ unittest {
import std.traits, std.typetuple;
import vibe.internal.meta.codegen;
import vibe.internal.meta.typetuple;
import vibe.web.internal.rest.common : ParameterKind;

interface Policies {
@headerParam("auth", "Authorization")
Expand Down Expand Up @@ -1507,7 +1508,7 @@ unittest {
Group!(__traits(getAttributes, IKeys!().create)),
Group!(PathAttribute("/"),
MethodAttribute(HTTPMethod.POST),
WPA(WPA.Origin.Header, "auth", "Authorization"))));
WPA(ParameterKind.header, "auth", "Authorization"))));

static if (__VERSION__ > 2065) {
void register() {
Expand Down

0 comments on commit 4166944

Please sign in to comment.