REST Service for POPCORN - ILIAS
alex
2025-06-20 8f37d4c717f0ff348ee4d23fb75ca6e017705603
test/testImportIliasUser.js
@@ -8,10 +8,11 @@
describe("the function importIliasUser", function () {
   let lastUserId = null
   const user = {
      // Action: "Insert",
      login: "affoReloaded",
      passwd: "test1234",
      login: "123456789",
      passwd: "123456789",
      passwd_type: "plain",
      firstname: "Adolfo",
      lastname: "de la Cruz",
@@ -28,6 +29,10 @@
      },
   }
   afterEach(async function () {
      // await deleteUser(lastUserId)
   })
   it("should import a new user to ILIAS", async function () {
      const res = await libIlias.importIliasUser(user)
      console.dir(res, {depth:null})
@@ -36,15 +41,24 @@
      expect(res.usr_id).to.be.a("number").above(0)
      const {usr_id} = res
      lastUserId = usr_id
      const user2 = await db.getUserByUserId(usr_id)
      console.log(user2)
      expect(user2).to.have.property("login").and.to.equal("affoReloaded")
      expect(user2).to.have.property("login").and.to.equal(user.login)
      expect(user2).to.have.property("usr_id").and.to.equal(res.usr_id)
      const res2 = await libIlias.deleteUser(usr_id)
      console.log(res2)
      expect(res2).to.have.property("status").and.to.equal("ok")
      expect(res2).to.have.property("command").and.to.equal("deleteUser")
      // const res2 = await libIlias.deleteUser(usr_id)
      // console.log(res2)
      // expect(res2).to.have.property("status").and.to.equal("ok")
      // expect(res2).to.have.property("command").and.to.equal("deleteUser")
   })
})
async function deleteUser (usr_id) {
   const res2 = await libIlias.deleteUser(usr_id)
   console.log(res2)
   expect(res2).to.have.property("status").and.to.equal("ok")
   expect(res2).to.have.property("command").and.to.equal("deleteUser")
}