Skip to content

Commit

Permalink
Railo test compatibility fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam Tuttle committed Aug 14, 2014
1 parent 75a2552 commit 4218310
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions tests/tests/TestCore.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,18 @@
function returns_etag_header(){
local.result = apiCall("get", "/echo/foo.json", "");
debug(local.result);
local.testStruct = StructNew();
local.testStruct.ID = "foo";
local.expectedValue = local.testStruct.hashCode();
assertTrue(structKeyExists(local.result.responseHeader, "Etag"));
assertEquals("99805", local.result.responseHeader.etag);
assertEquals(local.expectedValue, local.result.responseHeader.etag);
}

function returns_304_when_not_modified(){
local.testStruct = StructNew();
local.testStruct.ID = "foo";
local.h = {};
local.h['if-none-match'] = "99805";
local.h['if-none-match'] = local.testStruct.hashCode();
local.result = apiCall("get", "/echo/foo.json", "", local.h);
debug(local.result);
assertEquals(304, val(local.result.responseHeader.status_code));
Expand Down Expand Up @@ -343,7 +348,9 @@
debug( local.deserializedContent );

// The service response should contain the ID parameter and all parsed form fields from the body
assertEquals("bar,baz,foo,id,password,username", listSort(structKeylist(local.deserializedContent), "textnocase"));
local.sortedKeys = listSort(structKeylist(local.deserializedContent), "textnocase");
//because apparently railo includes fieldnames when ACF doesn't...
assertTrue("bar,baz,foo,id,password,username" eq local.sortedKeys or "bar,baz,fieldnames,foo,id,password,username" eq local.sortedKeys);
assertEquals(12, local.deserializedContent["id"]);
assertEquals("yankee", local.deserializedContent["foo"]);
assertEquals("hotel", local.deserializedContent["bar"]);
Expand Down

0 comments on commit 4218310

Please sign in to comment.