Commit be5913c7 authored by Romain Courteaud's avatar Romain Courteaud

[erp5_storage] Fix role and domain parsing

parent b9395035
...@@ -521,6 +521,7 @@ ...@@ -521,6 +521,7 @@
parsed_query.query_list.splice(i, 1); parsed_query.query_list.splice(i, 1);
query = jIO.Query.objectToSearchText(parsed_query); query = jIO.Query.objectToSearchText(parsed_query);
local_role_found = true; local_role_found = true;
sub_query = parsed_query.query_list[i];
} else { } else {
result_list = isMultipleLocalRoles(sub_query); result_list = isMultipleLocalRoles(sub_query);
if (result_list) { if (result_list) {
...@@ -528,6 +529,7 @@ ...@@ -528,6 +529,7 @@
parsed_query.query_list.splice(i, 1); parsed_query.query_list.splice(i, 1);
query = jIO.Query.objectToSearchText(parsed_query); query = jIO.Query.objectToSearchText(parsed_query);
local_role_found = true; local_role_found = true;
sub_query = parsed_query.query_list[i];
} }
} }
} }
......
...@@ -2076,6 +2076,59 @@ ...@@ -2076,6 +2076,59 @@
}); });
}); });
test("extract local_roles and selection_domain", function () {
var search_url = domain + "?mode=search&" +
"query=&" +
"select_list=uid&limit=5&" +
"local_roles=Assignee&" +
"selection_domain=%7B%22region%22%3A%22foo%2Fbar%22%7D",
search_hateoas = JSON.stringify({
"_embedded": {
"contents": []
}
}),
server = this.server;
this.server.respondWith("GET", domain, [200, {
"Content-Type": "application/hal+json"
}, root_hateoas]);
this.server.respondWith("GET", search_url, [200, {
"Content-Type": "application/hal+json"
}, search_hateoas]);
stop();
expect(10);
this.jio.allDocs({
limit: [5],
select_list: ["uid"],
query: 'local_roles:"Assignee" AND selection_domain_region:"foo/bar"'
})
.then(function (result) {
deepEqual(result, {
data: {
rows: [],
total_rows: 0
}
}, "Check document");
equal(server.requests.length, 2);
equal(server.requests[0].method, "GET");
equal(server.requests[0].url, domain);
equal(server.requests[0].requestBody, undefined);
equal(server.requests[0].withCredentials, true);
equal(server.requests[1].method, "GET");
equal(server.requests[1].url, search_url);
equal(server.requests[1].requestBody, undefined);
equal(server.requests[1].withCredentials, true);
})
.fail(function (error) {
ok(false, error);
})
.always(function () {
start();
});
});
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
// erp5Storage.put // erp5Storage.put
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment