quickshare/client/libs/test/api_auth_test.js
hekk 61a1c93f0f !1 Merge back to master
Merge pull request !1 from dev branch
2018-05-27 21:32:55 +08:00

34 lines
751 B
JavaScript

import { login, logout } from "../api_auth";
import { config } from "../../config";
const serverAddr = config.serverAddr;
const testId = config.testId;
const testPwd = config.testPwd;
export function testAuth() {
return testLogin()
.then(testLogout)
.catch(err => {
console.error("auth: fail", err);
});
}
export function testLogin() {
return login(serverAddr, testId, testPwd).then(ok => {
if (ok === true) {
console.log("login api: ok");
} else {
throw new Error("login api: failed");
}
});
}
export function testLogout() {
return logout(serverAddr).then(ok => {
if (ok === true) {
console.log("logout api: ok");
} else {
throw new Error("logout api: failed");
}
});
}