0
0
Fork 1
Spiegel von https://github.com/paviliondev/discourse-custom-wizard.git synchronisiert 2024-11-22 09:20:29 +01:00

DEV: Use helpers for api creation

Dieser Commit ist enthalten in:
jumagura 2023-03-21 04:56:48 -04:00
Ursprung 1254fcfb4e
Commit 014219c038
2 geänderte Dateien mit 39 neuen und 66 gelöschten Zeilen

Datei anzeigen

@ -1,12 +1,13 @@
import { acceptance, query } from "discourse/tests/helpers/qunit-helpers"; import { acceptance, query } from "discourse/tests/helpers/qunit-helpers";
import { test } from "qunit"; import { test } from "qunit";
import { click, select, visit } from "@ember/test-helpers"; import { click, visit } from "@ember/test-helpers";
import selectKit from "discourse/tests/helpers/select-kit-helper"; import selectKit from "discourse/tests/helpers/select-kit-helper";
import { import {
getBusinessAdminWizard, getBusinessAdminWizard,
getCustomFields, getCustomFields,
getNewApi, getNewApi,
getWizard, getWizard,
putNewApi,
} from "../helpers/admin-wizard"; } from "../helpers/admin-wizard";
acceptance("Admin | API tab", function (needs) { acceptance("Admin | API tab", function (needs) {
@ -39,73 +40,10 @@ acceptance("Admin | API tab", function (needs) {
return helper.response({ user_fields: [] }); return helper.response({ user_fields: [] });
}); });
server.put("/admin/wizards/api/new_api", () => { server.put("/admin/wizards/api/new_api", () => {
return helper.response({ return helper.response(putNewApi);
success: "OK",
api: {
name: "new_api",
title: "new API",
authorization: {
auth_type: "basic",
auth_url: null,
token_url: null,
client_id: null,
client_secret: null,
authorized: null,
auth_params: [],
access_token: null,
refresh_token: null,
token_expires_at: null,
token_refresh_at: null,
code: null,
username: "some_username",
password: "some_password",
},
endpoints: [
{
id: "8371de",
name: "endpoint_name",
method: "POST",
url: "https://test.api.com",
content_type: "application/json",
success_codes: [200, 100],
},
],
log: [],
},
});
}); });
server.get("/admin/wizards/api/new_api", () => { server.get("/admin/wizards/api/new_api", () => {
return helper.response({ return helper.response(getNewApi);
name: "new_api",
title: "new API",
authorization: {
auth_type: "basic",
auth_url: null,
token_url: null,
client_id: null,
client_secret: null,
authorized: null,
auth_params: [],
access_token: null,
refresh_token: null,
token_expires_at: null,
token_refresh_at: null,
code: null,
username: "some_username",
password: "some_password",
},
endpoints: [
{
id: "8371de",
name: "endpoint_name",
method: "POST",
url: "https://test.api.com",
content_type: "application/json",
success_codes: [200, 100],
},
],
log: [],
});
}); });
}); });

Datei anzeigen

@ -683,6 +683,40 @@ const getNewApi = {
], ],
log: [], log: [],
}; };
const putNewApi = {
success: "OK",
api: {
name: "new_api",
title: "new API",
authorization: {
auth_type: "basic",
auth_url: null,
token_url: null,
client_id: null,
client_secret: null,
authorized: null,
auth_params: [],
access_token: null,
refresh_token: null,
token_expires_at: null,
token_refresh_at: null,
code: null,
username: "some_username",
password: "some_password",
},
endpoints: [
{
id: "8371de",
name: "endpoint_name",
method: "POST",
url: "https://test.api.com",
content_type: "application/json",
success_codes: [200, 100],
},
],
log: [],
},
};
export { export {
getWizard, getWizard,
getUnsubscribedAdminWizards, getUnsubscribedAdminWizards,
@ -694,4 +728,5 @@ export {
getAdminTestingWizard, getAdminTestingWizard,
getCreatedWizard, getCreatedWizard,
getNewApi, getNewApi,
putNewApi,
}; };