REPO-1348/REPO-1349: implemented checks to guard against invalid fields

Explicitly rejects fields: id, guid and role

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.2.N/root@131408 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Matt Ward
2016-10-13 16:19:00 +00:00
parent 82f2708aa7
commit ba33a435d4
2 changed files with 57 additions and 1 deletions

View File

@@ -657,6 +657,44 @@ public class TestSites extends EnterpriseTestApi
null,
"Expected 400 response when updating "+site.getSiteId(), 400);
// Invalid fields
// Check that id, guid and role are not silently ignored. This is until REPO-110
// is implemented, since we currently have to bind to Site rather than SiteUpdate in
// SiteEntityResource.update
sitesProxy.update(
"sites",
site.getSiteId(),
null,
null,
"{\n" +
" \"id\": \"a-new-id\"," +
" \"title\": \"Updated Title\"\n" +
"}",
null,
"Expected 400 response when updating "+site.getSiteId(), 400);
sitesProxy.update(
"sites",
site.getSiteId(),
null,
null,
"{\n" +
" \"guid\": \"76ba60c1-f05b-406a-86a4-4eeb1bb49aaa\"" +
"}",
null,
"Expected 400 response when updating "+site.getSiteId(), 400);
sitesProxy.update(
"sites",
site.getSiteId(),
null,
null,
"{\n" +
" \"role\": \"SiteConsumer\"" +
"}",
null,
"Expected 400 response when updating "+site.getSiteId(), 400);
// Details should not have changed.
Site fresh = sitesProxy.getSite(site.getSiteId(), 200);
site.expected(fresh);