Send insecure verify skip on kapacitor create
Co-authored-by: Brandon Farmer <bthesorceror@gmail.com> Co-authored-by: Andrew Watkins <andrew.watkinz@gmail.com>pull/10616/head
parent
6fe1f9f5fe
commit
3e658bd44f
|
@ -1,10 +1,41 @@
|
||||||
|
export const source = {
|
||||||
|
id: '2',
|
||||||
|
name: 'minikube-influx',
|
||||||
|
type: 'influx',
|
||||||
|
url: 'http://192.168.99.100:30400',
|
||||||
|
'default': true,
|
||||||
|
telegraf: 'telegraf',
|
||||||
|
organization: 'default',
|
||||||
|
role: 'viewer',
|
||||||
|
links: {
|
||||||
|
self: '/chronograf/v1/sources/2',
|
||||||
|
kapacitors: '/chronograf/v1/sources/2/kapacitors',
|
||||||
|
proxy: '/chronograf/v1/sources/2/proxy',
|
||||||
|
queries: '/chronograf/v1/sources/2/queries',
|
||||||
|
write: '/chronograf/v1/sources/2/write',
|
||||||
|
permissions: '/chronograf/v1/sources/2/permissions',
|
||||||
|
users: '/chronograf/v1/sources/2/users',
|
||||||
|
databases: '/chronograf/v1/sources/2/dbs',
|
||||||
|
annotations: '/chronograf/v1/sources/2/annotations'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export const kapacitor = {
|
export const kapacitor = {
|
||||||
id: '1',
|
id: '1',
|
||||||
name: 'Test Kapacitor',
|
name: 'Test Kapacitor',
|
||||||
url: 'http://localhost:9092',
|
url: 'http://localhost:9092',
|
||||||
|
insecureSkipVerify: false,
|
||||||
active: true,
|
active: true,
|
||||||
links: {
|
links: {
|
||||||
self: '/chronograf/v1/sources/47/kapacitors/1',
|
self: '/chronograf/v1/sources/47/kapacitors/1',
|
||||||
proxy: '/chronograf/v1/sources/47/kapacitors/1/proxy',
|
proxy: '/chronograf/v1/sources/47/kapacitors/1/proxy',
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const createKapacitorBody = {
|
||||||
|
name: 'Test Kapacitor',
|
||||||
|
url: 'http://localhost:9092',
|
||||||
|
insecureSkipVerify: false,
|
||||||
|
username: 'user',
|
||||||
|
password: 'pass',
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
export default jest.fn(() => Promise.resolve())
|
|
@ -104,7 +104,7 @@ export const deleteKapacitor = async kapacitor => {
|
||||||
|
|
||||||
export function createKapacitor(
|
export function createKapacitor(
|
||||||
source,
|
source,
|
||||||
{url, name = 'My Kapacitor', username, password}
|
{url, name = 'My Kapacitor', username, password, insecureSkipVerify}
|
||||||
) {
|
) {
|
||||||
return AJAX({
|
return AJAX({
|
||||||
url: source.links.kapacitors,
|
url: source.links.kapacitors,
|
||||||
|
@ -114,6 +114,7 @@ export function createKapacitor(
|
||||||
url,
|
url,
|
||||||
username,
|
username,
|
||||||
password,
|
password,
|
||||||
|
insecureSkipVerify,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
import {createKapacitor} from 'src/shared/apis'
|
||||||
|
import {source, createKapacitorBody} from 'mocks/dummy'
|
||||||
|
import AJAX from 'src/utils/ajax'
|
||||||
|
|
||||||
|
jest.mock('src/utils/ajax', () => require('mocks/utils/ajax'))
|
||||||
|
|
||||||
|
describe('Shared.Apis', () => {
|
||||||
|
describe('createKapacitor', () => {
|
||||||
|
it('is called with the expected body', () => {
|
||||||
|
createKapacitor(source, createKapacitorBody)
|
||||||
|
|
||||||
|
expect(AJAX).toHaveBeenCalledWith({
|
||||||
|
url: source.links.kapacitors,
|
||||||
|
method: 'POST',
|
||||||
|
data: createKapacitorBody
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
Loading…
Reference in New Issue