Authentication 如何向foxx集成测试提供身份验证凭据
我正在ArangoDB上为Foxx服务编写集成测试,类似于中所述 但是,我的ArangoDB服务器配置了Authentication 如何向foxx集成测试提供身份验证凭据,authentication,arangodb,foxx,Authentication,Arangodb,Foxx,我正在ArangoDB上为Foxx服务编写集成测试,类似于中所述 但是,我的ArangoDB服务器配置了authentication system only=false,这意味着我需要使用ArangoDB身份验证来使用Foxx服务。但我不知道在运行测试时如何提供登录/密码 假设我的测试文件如下所示: "use strict"; const { expect } = require("chai"); const request = require("
authentication system only=false
,这意味着我需要使用ArangoDB身份验证来使用Foxx服务。但我不知道在运行测试时如何提供登录/密码
假设我的测试文件如下所示:
"use strict";
const { expect } = require("chai");
const request = require("@arangodb/request");
const { baseUrl } = module.context;
const user = "my_user";
const password = "my_password";
describe("this service", () => {
it("should say 'Hello World!' at the index route", () => {
const response = request.get(
baseUrl,
{
auth: {
username: user,
password: password
}
});
expect(response.status).to.equal(200);
expect(response.body).to.equal("Hello World!");
});
});
(注意我希望避免硬编码登录/密码)
我正在使用:curl-u我的用户:我的密码-X POST'http://myarangodb:8529/_db/mydb/_api/foxx/tests?mount=/graph“
有没有办法在测试执行时提供登录/密码
- 可能是通过启动测试来获得身份验证(curl命令仅适用于身份验证)
- 也许是通过向命令提供可以在脚本中重用的参数