grafana/tests/api/client.ts
Torkel Ödegaard ead1c300d7
API Integration Tests via jest (#10899)
* tests: experiment with api tests

* api tests are getting nice

* api: api testing ready for feedback
2018-02-14 10:26:20 +01:00

31 lines
529 B
TypeScript

const axios = require('axios');
export function getClient(options) {
return axios.create({
baseURL: 'http://localhost:3000',
timeout: 1000,
auth: {
username: options.username,
password: options.password,
},
});
}
export function getAdminClient() {
return getClient({
username: 'admin',
password: 'admin',
});
}
let client = getAdminClient();
client.callAs = function(user) {
return getClient({
username: user.login,
password: 'password',
});
};
export default client;