MXS-1300: Move the REST API tests back into the core

As the REST API is a part of the core, it is more appropriate for the
tests to reside there as well. Further refactoring of the testing needs to
be done to allow multiple components to use the same framework but with
different tests.
This commit is contained in:
Markus Mäkelä
2017-07-13 13:48:57 +03:00
parent a082871726
commit 01fa1a827a
22 changed files with 3 additions and 3 deletions

View File

@ -0,0 +1,59 @@
require("../utils.js")()
describe("Users", function() {
before(startMaxScale)
var user = {
data: {
id: "user1",
type: "inet",
attributes: {
}
}
}
it("add new user without password", function() {
return request.post(base_url + "/users/inet", { json: user })
.should.be.rejected
})
it("add user", function() {
user.data.attributes.password = "pw1"
return request.post(base_url + "/users/inet", { json: user })
.should.be.fulfilled
})
it("add user again", function() {
return request.post(base_url + "/users/inet", { json: user })
.should.be.rejected
})
it("add user again but without password", function() {
delete user.data.attributes.password
return request.post(base_url + "/users/inet", { json: user })
.should.be.rejected
})
it("get created user", function() {
return request.get(base_url + "/users/inet/user1")
.should.be.fulfilled
})
it("get non-existent user", function() {
return request.get(base_url + "/users/inet/user2")
.should.be.rejected
})
it("delete created user", function() {
return request.delete(base_url + "/users/inet/user1")
.should.be.fulfilled
})
it("delete created user again", function() {
return request.delete(base_url + "/users/inet/user1")
.should.be.rejected
})
after(stopMaxScale)
});