MXS-1220: Fix resource self links
The top level resource self links pointed to the collection instead of the resource itself. The individual resoures now also have a links field that contains the self link to the resource. This should make navigation of the API easier as all objects have valid links in them.
This commit is contained in:
@ -62,3 +62,47 @@ describe("Individual Resources", function() {
|
||||
|
||||
after(stopMaxScale)
|
||||
});
|
||||
|
||||
describe("Resource Self Links", function() {
|
||||
before(startMaxScale)
|
||||
|
||||
var tests = [
|
||||
"/servers",
|
||||
"/sessions",
|
||||
"/services",
|
||||
"/monitors",
|
||||
"/filters",
|
||||
"/maxscale/threads",
|
||||
"/maxscale/modules",
|
||||
"/maxscale/tasks",
|
||||
"/servers/server1",
|
||||
"/servers/server2",
|
||||
"/services/RW-Split-Router",
|
||||
"/services/RW-Split-Router/listeners",
|
||||
"/monitors/MySQL-Monitor",
|
||||
"/filters/Hint",
|
||||
"/sessions/1",
|
||||
"/maxscale/",
|
||||
"/maxscale/threads/0",
|
||||
"/maxscale/logs",
|
||||
"/maxscale/modules/readwritesplit",
|
||||
]
|
||||
|
||||
tests.forEach(function(endpoint) {
|
||||
it(endpoint + ': correct self link', function() {
|
||||
var obj = null;
|
||||
return request.get(base_url + endpoint)
|
||||
.then(function(resp) {
|
||||
obj = JSON.parse(resp)
|
||||
return request.get(obj.links.self)
|
||||
})
|
||||
.then(function(resp) {
|
||||
var obj_self = JSON.parse(resp)
|
||||
obj_self.links.self.should.be.equal(obj.links.self)
|
||||
})
|
||||
.should.be.fulfilled
|
||||
});
|
||||
})
|
||||
|
||||
after(stopMaxScale)
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user