Replaces cpanel edit with remove

This commit is contained in:
Akshay Nair committed 2020-10-15 22:13:01 +05:30
1 parent 1241ef85f8
commit b1da8a3ecc
2 files changed
+57 -4

No files matched your search

+52
View File
@@ -88,6 +88,33 @@ describe('Cpanel client', () => {
});
});
describe('addzonerecord', () => {
it('should make the correct request', async () => {
const fetch = mockFetch((url, request) => {
expect(url).toBe('https://example.com:2000/json-api/cpanel?domain=a.b&line=500&cpanel_jsonapi_user=boy&cpanel_jsonapi_module=ZoneEdit&cpanel_jsonapi_func=remove_zone_record&cpanel_jsonapi_apiversion=2');
expect(request).toEqual({
headers: {
Authorization: 'cpanel boy:boybyebye',
},
rejectUnauthorized: false,
});
});
const cpanel = CpanelClient({
host: 'example.com',
port: 2000,
username: 'boy',
apiKey: 'boybyebye',
domain: 'a.b',
dependencies: { fetch },
});
await cpanel.zone.remove({
line: 500,
});
});
});
describe('fetchredirections', () => {
it('should make the correct request', async () => {
const fetch = mockFetch((url, request) => {
@@ -139,5 +166,30 @@ describe('Cpanel client', () => {
});
});
});
describe('deleteredirection', () => {
it('should make the correct request', async () => {
const fetch = mockFetch((url, request) => {
expect(url).toBe('https://example.com:2000/execute/Mime/delete_redirect?domain=googo&cpanel_jsonapi_user=boy&cpanel_jsonapi_module=Mime&cpanel_jsonapi_func=delete_redirect&cpanel_jsonapi_apiversion=2');
expect(request).toEqual({
headers: {
Authorization: 'cpanel boy:boybyebye',
},
rejectUnauthorized: false,
});
});
const cpanel = CpanelClient({
host: 'example.com',
port: 2000,
username: 'boy',
apiKey: 'boybyebye',
domain: 'a.b',
dependencies: { fetch },
});
await cpanel.redirection.remove({ domain: 'googo' });
});
});
});