mirror of
https://github.com/ansible/awx.git
synced 2026-03-25 12:55:04 -02:30
Rename createInstanceGroups api method to associateInstanceGroup
This commit is contained in:
@@ -71,7 +71,7 @@ describe('<OrganizationAdd />', () => {
|
|||||||
test('Successful form submission triggers redirect', (done) => {
|
test('Successful form submission triggers redirect', (done) => {
|
||||||
const onSuccess = jest.spyOn(OrganizationAdd.WrappedComponent.prototype, 'onSuccess');
|
const onSuccess = jest.spyOn(OrganizationAdd.WrappedComponent.prototype, 'onSuccess');
|
||||||
const mockedResp = { data: { id: 1, related: { instance_groups: '/bar' } } };
|
const mockedResp = { data: { id: 1, related: { instance_groups: '/bar' } } };
|
||||||
const api = { createOrganization: jest.fn().mockResolvedValue(mockedResp), createInstanceGroups: jest.fn().mockResolvedValue('done') };
|
const api = { createOrganization: jest.fn().mockResolvedValue(mockedResp), associateInstanceGroup: jest.fn().mockResolvedValue('done') };
|
||||||
const wrapper = mount(
|
const wrapper = mount(
|
||||||
<MemoryRouter>
|
<MemoryRouter>
|
||||||
<I18nProvider>
|
<I18nProvider>
|
||||||
@@ -131,10 +131,10 @@ describe('<OrganizationAdd />', () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
const createInstanceGroupsFn = jest.fn().mockResolvedValue('done');
|
const associateInstanceGroupFn = jest.fn().mockResolvedValue('done');
|
||||||
const api = {
|
const api = {
|
||||||
createOrganization: createOrganizationFn,
|
createOrganization: createOrganizationFn,
|
||||||
createInstanceGroups: createInstanceGroupsFn
|
associateInstanceGroup: associateInstanceGroupFn
|
||||||
};
|
};
|
||||||
const wrapper = mount(
|
const wrapper = mount(
|
||||||
<MemoryRouter>
|
<MemoryRouter>
|
||||||
@@ -156,7 +156,7 @@ describe('<OrganizationAdd />', () => {
|
|||||||
description: '',
|
description: '',
|
||||||
name: 'mock org'
|
name: 'mock org'
|
||||||
});
|
});
|
||||||
expect(createInstanceGroupsFn).toHaveBeenCalledWith('/api/v2/organizations/1/instance_groups', 1);
|
expect(associateInstanceGroupFn).toHaveBeenCalledWith('/api/v2/organizations/1/instance_groups', 1);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('AnsibleSelect component renders if there are virtual environments', () => {
|
test('AnsibleSelect component renders if there are virtual environments', () => {
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ class APIClient {
|
|||||||
return this.http.get(API_INSTANCE_GROUPS, { params });
|
return this.http.get(API_INSTANCE_GROUPS, { params });
|
||||||
}
|
}
|
||||||
|
|
||||||
createInstanceGroups (url, id) {
|
associateInstanceGroup (url, id) {
|
||||||
return this.http.post(url, { id });
|
return this.http.post(url, { id });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ class OrganizationAdd extends React.Component {
|
|||||||
try {
|
try {
|
||||||
if (instanceGroups.length > 0) {
|
if (instanceGroups.length > 0) {
|
||||||
instanceGroups.forEach(async (select) => {
|
instanceGroups.forEach(async (select) => {
|
||||||
await api.createInstanceGroups(instanceGroupsUrl, select.id);
|
await api.associateInstanceGroup(instanceGroupsUrl, select.id);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|||||||
Reference in New Issue
Block a user