diff --git a/projects/cobbler-api/src/lib/cobbler-api.service.spec.ts b/projects/cobbler-api/src/lib/cobbler-api.service.spec.ts
index 5bdbed4d..846c6e58 100644
--- a/projects/cobbler-api/src/lib/cobbler-api.service.spec.ts
+++ b/projects/cobbler-api/src/lib/cobbler-api.service.spec.ts
@@ -1,7 +1,14 @@
import {TestBed} from '@angular/core/testing';
import {HttpClientTestingModule, HttpTestingController} from '@angular/common/http/testing';
-import {BackgroundBuildisoOptions, BackgroundImportOptions, BackgroundReplicateOptions} from 'cobbler-api';
-import {Event, ExtendedVersion, InstallationStatus} from './custom-types/misc';
+import {Distro, File, Image, Mgmgtclass, Package, Profile, Repo, System} from './custom-types/items';
+import {
+ BackgroundBuildisoOptions,
+ BackgroundImportOptions,
+ BackgroundReplicateOptions,
+ Event,
+ ExtendedVersion,
+ InstallationStatus
+} from './custom-types/misc';
import {COBBLER_URL} from './lib.config';
import {AngularXmlrpcService} from 'typescript-xmlrpc';
@@ -338,44 +345,398 @@ describe('CobblerApiService', () => {
expect(service).toBeFalsy();
});
- xit('should execute the get_distro action on the Cobbler Server', () => {
- service.get_distro('');
- expect(service).toBeFalsy();
+ it('should execute the get_distro action on the Cobbler Server', (done: DoneFn) => {
+ // eslint-disable-next-line max-len
+ const methodResponse = `parentdepth0ctime1721480439.039089mtime1721480439.039089uid12f034d6781946d1af0783e20684cbd4nametestcommentkernel_optionskernel_options_postautoinstall_metafetchable_filesboot_filestemplate_filesowners<<inherit>>mgmt_classesmgmt_parametersis_subobject0tree_build_time0.0archx86_64boot_loaders<<inherit>>breedinitrd/root/initrdkernel/root/kernelos_versionredhat_management_key<<inherit>>source_reposremote_boot_kernelremote_grub_kernelremote_boot_initrdremote_grub_initrdks_meta`
+ const result: Distro = {
+ ctime: 1721480439.039089,
+ depth: 0,
+ mtime: 1721480439.039089,
+ uid: "12f034d6781946d1af0783e20684cbd4",
+ source_repos: [],
+ tree_build_time: 0,
+ arch: "x86_64",
+ autoinstall_meta: {},
+ boot_files: {},
+ boot_loaders: "<>",
+ is_subobject: false,
+ parent: "",
+ breed: "",
+ comment: "",
+ fetchable_files: {},
+ initrd: "/root/initrd",
+ kernel: "/root/kernel",
+ remote_boot_initrd: "",
+ remote_boot_kernel: "",
+ remote_grub_initrd: "",
+ remote_grub_kernel: "",
+ kernel_options: {},
+ kernel_options_post: {},
+ mgmt_classes: [],
+ mgmt_parameters: {},
+ name: "test",
+ os_version: "",
+ owners: "<>",
+ redhat_management_key: "<>",
+ template_files: {},
+ }
+ service.get_distro('', false, false, "").subscribe(value => {
+ expect(value).toEqual(result)
+ done()
+ });
+ const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api');
+ mockRequest.flush(methodResponse);
});
- xit('should execute the get_profile action on the Cobbler Server', () => {
- service.get_profile('');
- expect(service).toBeFalsy();
+ it('should execute the get_profile action on the Cobbler Server', (done: DoneFn) => {
+ // eslint-disable-next-line max-len
+ const methodResponse = `parentdepth1ctime1721480439.3090012mtime1721480439.3090012uid5f01667614244fcd9c7ca7fa59c7def1nametestprofcommentkernel_options<<inherit>>kernel_options_post<<inherit>>autoinstall_meta<<inherit>>fetchable_files<<inherit>>boot_files<<inherit>>template_filesowners<<inherit>>mgmt_classes<<inherit>>mgmt_parameters<<inherit>>is_subobject0autoinstall<<inherit>>boot_loaders<<inherit>>dhcp_tagdistrotestenable_ipxe<<inherit>>enable_menu<<inherit>>name_serversname_servers_searchnext_server_v4<<inherit>>next_server_v6<<inherit>>filenameproxy<<inherit>>redhat_management_key<<inherit>>reposserver<<inherit>>menuvirt_auto_boot<<inherit>>virt_bridge<<inherit>>virt_cpus1virt_disk_driverrawvirt_file_size<<inherit>>virt_pathvirt_ram<<inherit>>virt_typexenpvkickstart<<inherit>>ks_meta<<inherit>>`
+ const result: Profile = {
+ name: "testprof",
+ depth: 1,
+ mtime: 1721480439.3090012,
+ is_subobject: false,
+ boot_loaders: "<>",
+ autoinstall_meta: "<>",
+ server: "<>",
+ distro: "test",
+ comment: "",
+ next_server_v4: "<>",
+ next_server_v6: "<>",
+ enable_ipxe: "<>",
+ parent: "",
+ owners: "<>",
+ autoinstall: "<>",
+ uid: "5f01667614244fcd9c7ca7fa59c7def1",
+ virt_ram: "<>",
+ boot_files: "<>",
+ mgmt_parameters: "<>",
+ name_servers: [],
+ enable_menu: "<>",
+ menu: "",
+ ctime: 1721480439.3090012,
+ fetchable_files: "<>",
+ mgmt_classes: "<>",
+ kernel_options: "<>",
+ virt_auto_boot: "<>",
+ kernel_options_post: "<>",
+ proxy: "<>",
+ filename: "",
+ dhcp_tag: "",
+ redhat_management_key: "<>",
+ repos: [],
+ template_files: {},
+ virt_type: "xenpv",
+ virt_cpus: 1,
+ virt_bridge: "<>",
+ name_servers_search: [],
+ virt_path: "",
+ virt_file_size: "<>",
+ virt_disk_driver: "raw",
+ }
+ service.get_profile('', false, false, "").subscribe(value => {
+ expect(value).toEqual(result)
+ done()
+ });
+ const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api');
+ mockRequest.flush(methodResponse);
});
- xit('should execute the get_system action on the Cobbler Server', () => {
- service.get_system('');
- expect(service).toBeFalsy();
+ it('should execute the get_system action on the Cobbler Server', (done: DoneFn) => {
+ // eslint-disable-next-line max-len
+ const methodResponse = `parentdepth2ctime1721480439.5932038mtime1721480439.5932038uida3320bc9105c44f1b92ab1743d460ed8nametestsyscommentkernel_options<<inherit>>kernel_options_post<<inherit>>autoinstall_meta<<inherit>>fetchable_files<<inherit>>boot_files<<inherit>>template_filesowners<<inherit>>mgmt_classes<<inherit>>mgmt_parameters<<inherit>>is_subobject0interfacesdefaultbonding_optsbridge_optscnamesconnected_mode0dhcp_tagdns_nameif_gatewayinterface_masterinterface_typenaip_addressipv6_addressipv6_default_gatewayipv6_mtuipv6_prefixipv6_secondariesipv6_static_routesmac_addressmanagement0mtunetmaskstatic0static_routesvirt_bridge<<inherit>>ipv6_autoconfiguration0repos_enabled0autoinstall<<inherit>>boot_loaders<<inherit>>enable_ipxe<<inherit>>gatewayhostnameimageipv6_default_devicename_serversname_servers_searchnetboot_enabled0next_server_v4<<inherit>>next_server_v6<<inherit>>filename<<inherit>>power_addresspower_idpower_passpower_typepower_userpower_optionspower_identity_fileprofiletestprofproxy<<inherit>>redhat_management_key<<inherit>>server<<inherit>>statusvirt_auto_boot<<inherit>>virt_cpus<<inherit>>virt_disk_driver<<inherit>>virt_file_size<<inherit>>virt_path<<inherit>>virt_pxe_boot0virt_ram<<inherit>>virt_type<<inherit>>serial_device-1serial_baud_rate-1kickstart<<inherit>>ks_meta<<inherit>>`
+ const result: System = {
+ ctime: 1721480439.5932038,
+ mtime: 1721480439.5932038,
+ name: "testsys",
+ depth: 2,
+ comment: "",
+ owners: "<>",
+ uid: "a3320bc9105c44f1b92ab1743d460ed8",
+ autoinstall: "<>",
+ boot_files: "<>",
+ boot_loaders: "<>",
+ parent: "",
+ is_subobject: false,
+ autoinstall_meta: "<>",
+ enable_ipxe: "<>",
+ fetchable_files: "<>",
+ filename: "<>",
+ gateway: "",
+ hostname: "",
+ image: "",
+ ipv6_autoconfiguration: false,
+ ipv6_default_device: "",
+ kernel_options: "<>",
+ kernel_options_post: "<>",
+ mgmt_classes: "<>",
+ mgmt_parameters: "<>",
+ name_servers: [],
+ name_servers_search: [],
+ netboot_enabled: false,
+ next_server_v4: "<>",
+ next_server_v6: "<>",
+ power_address: "",
+ power_id: "",
+ power_identity_file: "",
+ power_options: "",
+ power_pass: "",
+ power_type: "",
+ power_user: "",
+ profile: "testprof",
+ proxy: "<>",
+ redhat_management_key: "<>",
+ repos_enabled: false,
+ server: "<>",
+ serial_baud_rate: -1,
+ serial_device : -1,
+ status: "",
+ virt_auto_boot: "<>",
+ virt_disk_driver: "<>",
+ virt_path: "<>",
+ virt_ram: "<>",
+ virt_type: "<>",
+ virt_file_size: "<>",
+ virt_cpus: "<>",
+ virt_pxe_boot: false,
+ template_files: {},
+ interfaces: {
+ default: {
+ bonding_opts: '',
+ bridge_opts: '',
+ cnames: [],
+ connected_mode: false,
+ dhcp_tag: '',
+ dns_name: '',
+ if_gateway: '',
+ interface_master: '',
+ interface_type: 'na',
+ ip_address: '',
+ ipv6_address: '',
+ ipv6_default_gateway: '',
+ ipv6_mtu: '',
+ ipv6_prefix: '',
+ ipv6_secondaries: [],
+ ipv6_static_routes: [],
+ mac_address: '',
+ management: false,
+ mtu: '',
+ netmask: '',
+ static: false,
+ static_routes: [],
+ virt_bridge: '<>',
+ }
+ },
+ }
+ service.get_system('', false, false, "").subscribe(value => {
+ expect(value).toEqual(result)
+ done()
+ });
+ const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api');
+ mockRequest.flush(methodResponse);
});
- xit('should execute the get_repo action on the Cobbler Server', () => {
- service.get_repo('');
- expect(service).toBeFalsy();
+ it('should execute the get_repo action on the Cobbler Server', (done: DoneFn) => {
+ // eslint-disable-next-line max-len
+ const methodResponse = `parentdepth0ctime1721480440.9711354mtime1721480440.9711354uid8b58f9b09a3e4d28965160d97a5de482nametestrepocommentkernel_optionskernel_options_postautoinstall_metafetchable_filesboot_filestemplate_filesowners<<inherit>>mgmt_classes<<inherit>>mgmt_parametersis_subobject0breednonearchnoneenvironmentyumoptsrsyncoptsmirror_typebaseurlapt_componentsapt_distscreaterepo_flags<<inherit>>keep_updated0mirrormirror_locally0priority0proxy<<inherit>>rpm_listos_versionks_meta`
+ const result: Repo = {
+ ctime: 1721480440.9711354,
+ mtime: 1721480440.9711354,
+ name: "testrepo",
+ depth: 0,
+ comment: "",
+ owners: "<>",
+ uid: "8b58f9b09a3e4d28965160d97a5de482",
+ fetchable_files: {},
+ is_subobject: false,
+ parent: "",
+ kernel_options: {},
+ kernel_options_post: {},
+ mgmt_classes: "<>",
+ mgmt_parameters: {},
+ arch: "none",
+ breed: "none",
+ apt_components: [],
+ apt_dists: [],
+ mirror: "",
+ rsyncopts: {},
+ proxy: "<>",
+ createrepo_flags: "<>",
+ environment: {},
+ keep_updated: false,
+ mirror_locally: false,
+ mirror_type: "baseurl",
+ priority: 0,
+ rpm_list: [],
+ yumopts: {},
+ autoinstall_meta: {},
+ boot_files: {},
+ os_version: "",
+ template_files: {},
+ }
+ service.get_repo('', false, false, "").subscribe(value => {
+ expect(value).toEqual(result)
+ done()
+ });
+ const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api');
+ mockRequest.flush(methodResponse);
});
- xit('should execute the get_image action on the Cobbler Server', () => {
- service.get_image('');
- expect(service).toBeFalsy();
+ it('should execute the get_image action on the Cobbler Server', (done: DoneFn) => {
+ // eslint-disable-next-line max-len
+ const methodResponse = `parentdepth0ctime1721480441.493743mtime1721480441.493743uid911577c3691b4294acdf017e7f15f4cfnametestimagecommentkernel_optionskernel_options_postautoinstall_metafetchable_filesboot_filestemplate_filesowners<<inherit>>mgmt_classes<<inherit>>mgmt_parametersis_subobject0archx86_64autoinstall<<inherit>>breedfileimage_typedirectnetwork_count0os_versionboot_loadersmenuvirt_auto_boot0virt_bridge<<inherit>>virt_cpus1virt_disk_driverrawvirt_file_size<<inherit>>virt_pathvirt_ram<<inherit>>virt_type<<inherit>>kickstart<<inherit>>ks_meta`
+ const result: Image = {
+ ctime: 1721480441.493743,
+ mtime: 1721480441.493743,
+ name: "testimage",
+ depth: 0,
+ comment: "",
+ owners: "<>",
+ uid: "911577c3691b4294acdf017e7f15f4cf",
+ arch: "x86_64",
+ breed: "",
+ file: "",
+ fetchable_files: {},
+ is_subobject: false,
+ parent: "",
+ kernel_options: {},
+ kernel_options_post: {},
+ mgmt_classes: "<>",
+ mgmt_parameters: {},
+ autoinstall: "<>",
+ image_type: "direct",
+ network_count: 0,
+ os_version: "",
+ virt_auto_boot: false,
+ virt_bridge: "<>",
+ virt_cpus: 1,
+ virt_disk_driver: "raw",
+ virt_file_size: "<>",
+ virt_path: "",
+ virt_ram: "<>",
+ virt_type: "<>",
+ menu: "",
+ autoinstall_meta: {},
+ boot_files: {},
+ boot_loaders: [],
+ template_files: {},
+ }
+ service.get_image('', false, false, "").subscribe(value => {
+ expect(value).toEqual(result)
+ done()
+ });
+ const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api');
+ mockRequest.flush(methodResponse);
});
- xit('should execute the get_mgmtclass action on the Cobbler Server', () => {
- service.get_mgmtclass('');
- expect(service).toBeFalsy();
+ it('should execute the get_mgmtclass action on the Cobbler Server', (done: DoneFn) => {
+ // eslint-disable-next-line max-len
+ const methodResponse = `parentdepth0ctime1721480442.0213087mtime1721480442.0213087uid5a4898be6fca4d7884898fa60a64e6dcnametestmgmtclasscommentkernel_optionskernel_options_postautoinstall_metafetchable_filesboot_filestemplate_filesowners<<inherit>>mgmt_classes<<inherit>>mgmt_parametersis_subobject0is_definition0paramsclass_namefilespackagesks_meta`
+ const result: Mgmgtclass = {
+ ctime: 1721480442.0213087,
+ mtime: 1721480442.0213087,
+ name: "testmgmtclass",
+ depth: 0,
+ comment: "",
+ owners: "<>",
+ uid: "5a4898be6fca4d7884898fa60a64e6dc",
+ fetchable_files: {},
+ is_subobject: false,
+ parent: "",
+ kernel_options: {},
+ kernel_options_post: {},
+ mgmt_classes: "<>",
+ mgmt_parameters: {},
+ class_name: "",
+ files: [],
+ is_definition: false,
+ packages: [],
+ params: {},
+ autoinstall_meta: {},
+ boot_files: {},
+ template_files: {},
+ }
+ service.get_mgmtclass('', false, false, "").subscribe(value => {
+ expect(value).toEqual(result)
+ done()
+ });
+ const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api');
+ mockRequest.flush(methodResponse);
});
- xit('should execute the get_package action on the Cobbler Server', () => {
- service.get_package('');
- expect(service).toBeFalsy();
+ it('should execute the get_package action on the Cobbler Server', (done: DoneFn) => {
+ // eslint-disable-next-line max-len
+ const methodResponse = `parentdepth0ctime1721480441.7595894mtime1721480441.7595894uida6d7ee9851d74f73b9f393f89efd4caenametestpackagecommentkernel_optionskernel_options_postautoinstall_metafetchable_filesboot_filestemplate_filesowners<<inherit>>mgmt_classes<<inherit>>mgmt_parametersis_subobject0actioncreatemodeownergrouppathtemplateinstallerversionks_meta`
+ const result: Package = {
+ ctime: 1721480441.7595894,
+ mtime: 1721480441.7595894,
+ name: "testpackage",
+ depth: 0,
+ comment: "",
+ owners: "<>",
+ uid: "a6d7ee9851d74f73b9f393f89efd4cae",
+ action: "create",
+ installer: "",
+ version: "",
+ mode: "",
+ group: "",
+ owner: "",
+ path: "",
+ template: "",
+ fetchable_files: {},
+ is_subobject: false,
+ parent: "",
+ kernel_options: {},
+ kernel_options_post: {},
+ mgmt_classes: "<>",
+ mgmt_parameters: {},
+ boot_files: {},
+ autoinstall_meta: {},
+ template_files: {},
+ }
+ service.get_package('', false, false, "").subscribe(value => {
+ expect(value).toEqual(result)
+ done()
+ });
+ const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api');
+ mockRequest.flush(methodResponse);
});
- xit('should execute the get_file action on the Cobbler Server', () => {
- service.get_file('');
- expect(service).toBeFalsy();
+ it('should execute the get_file action on the Cobbler Server', (done: DoneFn) => {
+ // eslint-disable-next-line max-len
+ const methodResponse = `parentdepth0ctime1721480443.0627294mtime1721480443.0627294uid650659dad2694598a14632f4a434c4a9nametestfilecommentkernel_optionskernel_options_postautoinstall_metafetchable_filesboot_filestemplate_filesowners<<inherit>>mgmt_classes<<inherit>>mgmt_parametersis_subobject0actioncreatemode0644ownerrootgrouprootpath/root/testfiletemplate/etc/cobbler/dhcp.templateis_dir0ks_meta`
+ const result: File = {
+ ctime: 1721480443.0627294,
+ mtime: 1721480443.0627294,
+ name: "testfile",
+ depth: 0,
+ comment: "",
+ owners: "<>",
+ uid: "650659dad2694598a14632f4a434c4a9",
+ owner: "root",
+ action: "create",
+ group: "root",
+ is_dir: false,
+ mode: "0644",
+ path: "/root/testfile",
+ template: "/etc/cobbler/dhcp.template",
+ fetchable_files: {},
+ is_subobject: false,
+ kernel_options: {},
+ kernel_options_post: {},
+ mgmt_classes: "<>",
+ mgmt_parameters: {},
+ template_files: {},
+ autoinstall_meta: {},
+ boot_files: {},
+ parent: "",
+ }
+ service.get_file('', false, false, "").subscribe(value => {
+ expect(value).toEqual(result)
+ done()
+ });
+ const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api');
+ mockRequest.flush(methodResponse);
});
xit('should execute the get_items action on the Cobbler Server', () => {
@@ -383,49 +744,426 @@ describe('CobblerApiService', () => {
expect(service).toBeFalsy();
});
- xit('should execute the get_item_names action on the Cobbler Server', () => {
- service.get_item_names('');
- expect(service).toBeFalsy();
+ it('should execute the get_item_names action on the Cobbler Server', (done: DoneFn) => {
+ // eslint-disable-next-line max-len
+ const methodResponse = `testdistro`
+ const result = ["testdistro"]
+ service.get_item_names('distro').subscribe(value => {
+ expect(value).toEqual(result)
+ done()
+ });
+ const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api');
+ mockRequest.flush(methodResponse);
});
- xit('should execute the get_distros action on the Cobbler Server', () => {
- service.get_distros();
- expect(service).toBeFalsy();
+ it('should execute the get_distros action on the Cobbler Server', (done: DoneFn) => {
+ // eslint-disable-next-line max-len
+ const methodResponse = `parentdepth0ctime1721480439.039089mtime1721480439.039089uid12f034d6781946d1af0783e20684cbd4nametestcommentkernel_optionskernel_options_postautoinstall_metafetchable_filesboot_filestemplate_filesowners<<inherit>>mgmt_classesmgmt_parametersis_subobject0tree_build_time0.0archx86_64boot_loaders<<inherit>>breedinitrd/root/initrdkernel/root/kernelos_versionredhat_management_key<<inherit>>source_reposremote_boot_kernelremote_grub_kernelremote_boot_initrdremote_grub_initrdks_meta`
+ const result: Array = [
+ {
+ ctime: 1721480439.039089,
+ depth: 0,
+ mtime: 1721480439.039089,
+ uid: "12f034d6781946d1af0783e20684cbd4",
+ source_repos: [],
+ tree_build_time: 0,
+ arch: "x86_64",
+ autoinstall_meta: {},
+ boot_files: {},
+ boot_loaders: "<>",
+ is_subobject: false,
+ parent: "",
+ breed: "",
+ comment: "",
+ fetchable_files: {},
+ initrd: "/root/initrd",
+ kernel: "/root/kernel",
+ remote_boot_initrd: "",
+ remote_boot_kernel: "",
+ remote_grub_initrd: "",
+ remote_grub_kernel: "",
+ kernel_options: {},
+ kernel_options_post: {},
+ mgmt_classes: [],
+ mgmt_parameters: {},
+ name: "test",
+ os_version: "",
+ owners: "<>",
+ redhat_management_key: "<>",
+ template_files: {}
+ }
+ ]
+ service.get_distros().subscribe(value => {
+ expect(value).toEqual(result)
+ done()
+ });
+ const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api');
+ mockRequest.flush(methodResponse);
});
- xit('should execute the get_profiles action on the Cobbler Server', () => {
- service.get_profiles();
- expect(service).toBeFalsy();
+ it('should execute the get_profiles action on the Cobbler Server', (done: DoneFn) => {
+ // eslint-disable-next-line max-len
+ const methodResponse = `parentdepth1ctime1721480439.3090012mtime1721480439.3090012uid5f01667614244fcd9c7ca7fa59c7def1nametestprofcommentkernel_options<<inherit>>kernel_options_post<<inherit>>autoinstall_meta<<inherit>>fetchable_files<<inherit>>boot_files<<inherit>>template_filesowners<<inherit>>mgmt_classes<<inherit>>mgmt_parameters<<inherit>>is_subobject0autoinstall<<inherit>>boot_loaders<<inherit>>dhcp_tagdistrotestenable_ipxe<<inherit>>enable_menu<<inherit>>name_serversname_servers_searchnext_server_v4<<inherit>>next_server_v6<<inherit>>filenameproxy<<inherit>>redhat_management_key<<inherit>>reposserver<<inherit>>menuvirt_auto_boot<<inherit>>virt_bridge<<inherit>>virt_cpus1virt_disk_driverrawvirt_file_size<<inherit>>virt_pathvirt_ram<<inherit>>virt_typexenpvkickstart<<inherit>>ks_meta<<inherit>>`
+ const result: Array = [
+ {
+ name: "testprof",
+ depth: 1,
+ mtime: 1721480439.3090012,
+ is_subobject: false,
+ boot_loaders: "<>",
+ autoinstall_meta: "<>",
+ server: "<>",
+ distro: "test",
+ comment: "",
+ next_server_v4: "<>",
+ next_server_v6: "<>",
+ enable_ipxe: "<>",
+ parent: "",
+ owners: "<>",
+ autoinstall: "<>",
+ uid: "5f01667614244fcd9c7ca7fa59c7def1",
+ virt_ram: "<>",
+ boot_files: "<>",
+ mgmt_parameters: "<>",
+ name_servers: [],
+ enable_menu: "<>",
+ menu: "",
+ ctime: 1721480439.3090012,
+ fetchable_files: "<>",
+ mgmt_classes: "<>",
+ kernel_options: "<>",
+ virt_auto_boot: "<>",
+ kernel_options_post: "<>",
+ proxy: "<>",
+ filename: "",
+ dhcp_tag: "",
+ redhat_management_key: "<>",
+ repos: [],
+ template_files: {},
+ virt_type: "xenpv",
+ virt_cpus: 1,
+ virt_bridge: "<>",
+ name_servers_search: [],
+ virt_path: "",
+ virt_file_size: "<>",
+ virt_disk_driver: "raw",
+ }
+ ]
+ service.get_profiles().subscribe(value => {
+ expect(value).toEqual(result)
+ done()
+ });
+ const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api');
+ mockRequest.flush(methodResponse);
});
- xit('should execute the get_systems action on the Cobbler Server', () => {
- service.get_systems();
- expect(service).toBeFalsy();
+ it('should execute the get_systems action on the Cobbler Server', (done: DoneFn) => {
+ // eslint-disable-next-line max-len
+ const methodResponse = `parentdepth2ctime1721480439.5932038mtime1721480439.5932038uida3320bc9105c44f1b92ab1743d460ed8nametestsyscommentkernel_options<<inherit>>kernel_options_post<<inherit>>autoinstall_meta<<inherit>>fetchable_files<<inherit>>boot_files<<inherit>>template_filesowners<<inherit>>mgmt_classes<<inherit>>mgmt_parameters<<inherit>>is_subobject0interfacesdefaultbonding_optsbridge_optscnamesconnected_mode0dhcp_tagdns_nameif_gatewayinterface_masterinterface_typenaip_addressipv6_addressipv6_default_gatewayipv6_mtuipv6_prefixipv6_secondariesipv6_static_routesmac_addressmanagement0mtunetmaskstatic0static_routesvirt_bridge<<inherit>>ipv6_autoconfiguration0repos_enabled0autoinstall<<inherit>>boot_loaders<<inherit>>enable_ipxe<<inherit>>gatewayhostnameimageipv6_default_devicename_serversname_servers_searchnetboot_enabled0next_server_v4<<inherit>>next_server_v6<<inherit>>filename<<inherit>>power_addresspower_idpower_passpower_typepower_userpower_optionspower_identity_fileprofiletestprofproxy<<inherit>>redhat_management_key<<inherit>>server<<inherit>>statusvirt_auto_boot<<inherit>>virt_cpus<<inherit>>virt_disk_driver<<inherit>>virt_file_size<<inherit>>virt_path<<inherit>>virt_pxe_boot0virt_ram<<inherit>>virt_type<<inherit>>serial_device-1serial_baud_rate-1kickstart<<inherit>>ks_meta<<inherit>>`
+ const result: Array = [
+ {
+ ctime: 1721480439.5932038,
+ mtime: 1721480439.5932038,
+ name: "testsys",
+ depth: 2,
+ comment: "",
+ owners: "<>",
+ uid: "a3320bc9105c44f1b92ab1743d460ed8",
+ autoinstall: "<>",
+ boot_files: "<>",
+ boot_loaders: "<>",
+ parent: "",
+ is_subobject: false,
+ autoinstall_meta: "<>",
+ enable_ipxe: "<>",
+ fetchable_files: "<>",
+ filename: "<>",
+ gateway: "",
+ hostname: "",
+ image: "",
+ ipv6_autoconfiguration: false,
+ ipv6_default_device: "",
+ kernel_options: "<>",
+ kernel_options_post: "<>",
+ mgmt_classes: "<>",
+ mgmt_parameters: "<>",
+ name_servers: [],
+ name_servers_search: [],
+ netboot_enabled: false,
+ next_server_v4: "<>",
+ next_server_v6: "<>",
+ power_address: "",
+ power_id: "",
+ power_identity_file: "",
+ power_options: "",
+ power_pass: "",
+ power_type: "",
+ power_user: "",
+ profile: "testprof",
+ proxy: "<>",
+ redhat_management_key: "<>",
+ repos_enabled: false,
+ server: "<>",
+ serial_baud_rate: -1,
+ serial_device: -1,
+ status: "",
+ virt_auto_boot: "<>",
+ virt_disk_driver: "<>",
+ virt_path: "<>",
+ virt_ram: "<>",
+ virt_type: "<>",
+ virt_file_size: "<>",
+ virt_cpus: "<>",
+ virt_pxe_boot: false,
+ template_files: {},
+ interfaces: {
+ default: {
+ bonding_opts: '',
+ bridge_opts: '',
+ cnames: [],
+ connected_mode: false,
+ dhcp_tag: '',
+ dns_name: '',
+ if_gateway: '',
+ interface_master: '',
+ interface_type: 'na',
+ ip_address: '',
+ ipv6_address: '',
+ ipv6_default_gateway: '',
+ ipv6_mtu: '',
+ ipv6_prefix: '',
+ ipv6_secondaries: [],
+ ipv6_static_routes: [],
+ mac_address: '',
+ management: false,
+ mtu: '',
+ netmask: '',
+ static: false,
+ static_routes: [],
+ virt_bridge: '<>',
+ }
+ }
+ }
+ ]
+ service.get_systems().subscribe(value => {
+ expect(value).toEqual(result)
+ done()
+ });
+ const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api');
+ mockRequest.flush(methodResponse);
});
- xit('should execute the get_repos action on the Cobbler Server', () => {
- service.get_repos();
- expect(service).toBeFalsy();
+ it('should execute the get_repos action on the Cobbler Server', (done: DoneFn) => {
+ // eslint-disable-next-line max-len
+ const methodResponse = `parentdepth0ctime1721480440.9711354mtime1721480440.9711354uid8b58f9b09a3e4d28965160d97a5de482nametestrepocommentkernel_optionskernel_options_postautoinstall_metafetchable_filesboot_filestemplate_filesowners<<inherit>>mgmt_classes<<inherit>>mgmt_parametersis_subobject0breednonearchnoneenvironmentyumoptsrsyncoptsmirror_typebaseurlapt_componentsapt_distscreaterepo_flags<<inherit>>keep_updated0mirrormirror_locally0priority0proxy<<inherit>>rpm_listos_versionks_meta`
+ const result: Array = [
+ {
+ ctime: 1721480440.9711354,
+ mtime: 1721480440.9711354,
+ name: "testrepo",
+ depth: 0,
+ comment: "",
+ owners: "<>",
+ uid: "8b58f9b09a3e4d28965160d97a5de482",
+ fetchable_files: {},
+ is_subobject: false,
+ parent: "",
+ kernel_options: {},
+ kernel_options_post: {},
+ mgmt_classes: "<>",
+ mgmt_parameters: {},
+ arch: "none",
+ breed: "none",
+ apt_components: [],
+ apt_dists: [],
+ mirror: "",
+ rsyncopts: {},
+ proxy: "<>",
+ createrepo_flags: "<>",
+ environment: {},
+ keep_updated: false,
+ mirror_locally: false,
+ mirror_type: "baseurl",
+ priority: 0,
+ rpm_list: [],
+ yumopts: {},
+ autoinstall_meta: {},
+ boot_files: {},
+ os_version: "",
+ template_files: {},
+ }
+ ]
+ service.get_repos().subscribe(value => {
+ expect(value).toEqual(result)
+ done()
+ });
+ const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api');
+ mockRequest.flush(methodResponse);
});
- xit('should execute the get_images action on the Cobbler Server', () => {
- service.get_images();
- expect(service).toBeFalsy();
+ it('should execute the get_images action on the Cobbler Server', (done: DoneFn) => {
+ // eslint-disable-next-line max-len
+ const methodResponse = `parentdepth0ctime1721480441.493743mtime1721480441.493743uid911577c3691b4294acdf017e7f15f4cfnametestimagecommentkernel_optionskernel_options_postautoinstall_metafetchable_filesboot_filestemplate_filesowners<<inherit>>mgmt_classes<<inherit>>mgmt_parametersis_subobject0archx86_64autoinstall<<inherit>>breedfileimage_typedirectnetwork_count0os_versionboot_loadersmenuvirt_auto_boot0virt_bridge<<inherit>>virt_cpus1virt_disk_driverrawvirt_file_size<<inherit>>virt_pathvirt_ram<<inherit>>virt_type<<inherit>>kickstart<<inherit>>ks_meta`
+ const result: Array = [
+ {
+ ctime: 1721480441.493743,
+ mtime: 1721480441.493743,
+ name: "testimage",
+ depth: 0,
+ comment: "",
+ owners: "<>",
+ uid: "911577c3691b4294acdf017e7f15f4cf",
+ arch: "x86_64",
+ breed: "",
+ file: "",
+ fetchable_files: {},
+ is_subobject: false,
+ parent: "",
+ kernel_options: {},
+ kernel_options_post: {},
+ mgmt_classes: "<>",
+ mgmt_parameters: {},
+ autoinstall: "<>",
+ image_type: "direct",
+ network_count: 0,
+ os_version: "",
+ virt_auto_boot: false,
+ virt_bridge: "<>",
+ virt_cpus: 1,
+ virt_disk_driver: "raw",
+ virt_file_size: "<>",
+ virt_path: "",
+ virt_ram: "<>",
+ virt_type: "<>",
+ menu: "",
+ autoinstall_meta: {},
+ boot_files: {},
+ boot_loaders: [],
+ template_files: {},
+ }
+ ]
+ service.get_images().subscribe(value => {
+ expect(value).toEqual(result)
+ done()
+ });
+ const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api');
+ mockRequest.flush(methodResponse);
});
- xit('should execute the get_mgmtclasses action on the Cobbler Server', () => {
- service.get_mgmtclasses();
- expect(service).toBeFalsy();
+ it('should execute the get_mgmtclasses action on the Cobbler Server', (done: DoneFn) => {
+ // eslint-disable-next-line max-len
+ const methodResponse = `parentdepth0ctime1721480442.0213087mtime1721480442.0213087uid5a4898be6fca4d7884898fa60a64e6dcnametestmgmtclasscommentkernel_optionskernel_options_postautoinstall_metafetchable_filesboot_filestemplate_filesowners<<inherit>>mgmt_classes<<inherit>>mgmt_parametersis_subobject0is_definition0paramsclass_namefilespackagesks_meta`
+ const result: Array = [
+ {
+ ctime: 1721480442.0213087,
+ mtime: 1721480442.0213087,
+ name: "testmgmtclass",
+ depth: 0,
+ comment: "",
+ owners: "<>",
+ uid: "5a4898be6fca4d7884898fa60a64e6dc",
+ fetchable_files: {},
+ is_subobject: false,
+ parent: "",
+ kernel_options: {},
+ kernel_options_post: {},
+ mgmt_classes: "<>",
+ mgmt_parameters: {},
+ class_name: "",
+ files: [],
+ is_definition: false,
+ packages: [],
+ params: {},
+ autoinstall_meta: {},
+ boot_files: {},
+ template_files: {},
+ }
+ ]
+ service.get_mgmtclasses().subscribe(value => {
+ expect(value).toEqual(result)
+ done()
+ });
+ const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api');
+ mockRequest.flush(methodResponse);
});
- xit('should execute the get_packages action on the Cobbler Server', () => {
- service.get_packages();
- expect(service).toBeFalsy();
+ it('should execute the get_packages action on the Cobbler Server', (done: DoneFn) => {
+ // eslint-disable-next-line max-len
+ const methodResponse = `parentdepth0ctime1721480441.7595894mtime1721480441.7595894uida6d7ee9851d74f73b9f393f89efd4caenametestpackagecommentkernel_optionskernel_options_postautoinstall_metafetchable_filesboot_filestemplate_filesowners<<inherit>>mgmt_classes<<inherit>>mgmt_parametersis_subobject0actioncreatemodeownergrouppathtemplateinstallerversionks_meta`
+ const result: Array = [
+ {
+ ctime: 1721480441.7595894,
+ mtime: 1721480441.7595894,
+ name: "testpackage",
+ depth: 0,
+ comment: "",
+ owners: "<>",
+ uid: "a6d7ee9851d74f73b9f393f89efd4cae",
+ action: "create",
+ installer: "",
+ version: "",
+ mode: "",
+ group: "",
+ owner: "",
+ path: "",
+ template: "",
+ fetchable_files: {},
+ is_subobject: false,
+ parent: "",
+ kernel_options: {},
+ kernel_options_post: {},
+ mgmt_classes: "<>",
+ mgmt_parameters: {},
+ boot_files: {},
+ autoinstall_meta: {},
+ template_files: {},
+ }
+ ]
+ service.get_packages().subscribe(value => {
+ expect(value).toEqual(result)
+ done()
+ });
+ const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api');
+ mockRequest.flush(methodResponse);
});
- xit('should execute the get_files action on the Cobbler Server', () => {
- service.get_files();
- expect(service).toBeFalsy();
+ it('should execute the get_files action on the Cobbler Server', (done: DoneFn) => {
+ // eslint-disable-next-line max-len
+ const methodResponse = `parentdepth0ctime1721480443.0627294mtime1721480443.0627294uid650659dad2694598a14632f4a434c4a9nametestfilecommentkernel_optionskernel_options_postautoinstall_metafetchable_filesboot_filestemplate_filesowners<<inherit>>mgmt_classes<<inherit>>mgmt_parametersis_subobject0actioncreatemode0644ownerrootgrouprootpath/root/testfiletemplate/etc/cobbler/dhcp.templateis_dir0ks_meta`
+ const result: Array = [
+ {
+ ctime: 1721480443.0627294,
+ mtime: 1721480443.0627294,
+ name: "testfile",
+ depth: 0,
+ comment: "",
+ owners: "<>",
+ uid: "650659dad2694598a14632f4a434c4a9",
+ owner: "root",
+ action: "create",
+ group: "root",
+ is_dir: false,
+ mode: "0644",
+ path: "/root/testfile",
+ template: "/etc/cobbler/dhcp.template",
+ fetchable_files: {},
+ is_subobject: false,
+ kernel_options: {},
+ kernel_options_post: {},
+ mgmt_classes: "<>",
+ mgmt_parameters: {},
+ template_files: {},
+ autoinstall_meta: {},
+ boot_files: {},
+ parent: "",
+ }
+ ]
+ service.get_files().subscribe(value => {
+ expect(value).toEqual(result)
+ done()
+ });
+ const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api');
+ mockRequest.flush(methodResponse);
});
xit('should execute the find_items action on the Cobbler Server', () => {
@@ -488,44 +1226,100 @@ describe('CobblerApiService', () => {
expect(service).toBeFalsy();
});
- xit('should execute the get_distro_handle action on the Cobbler Server', () => {
- service.get_distro_handle('', '');
- expect(service).toBeFalsy();
+ it('should execute the get_distro_handle action on the Cobbler Server', (done: DoneFn) => {
+ // eslint-disable-next-line max-len
+ const methodResponse = `distro::test`
+ const result = "distro::test"
+ service.get_distro_handle("", "").subscribe(value => {
+ expect(value).toEqual(result)
+ done()
+ });
+ const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api');
+ mockRequest.flush(methodResponse);
});
- xit('should execute the get_profile_handle action on the Cobbler Server', () => {
- service.get_profile_handle('', '');
- expect(service).toBeFalsy();
+ it('should execute the get_profile_handle action on the Cobbler Server', (done: DoneFn) => {
+ // eslint-disable-next-line max-len
+ const methodResponse = `profile::testprof`
+ const result = "profile::testprof"
+ service.get_profile_handle("", "").subscribe(value => {
+ expect(value).toEqual(result)
+ done()
+ });
+ const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api');
+ mockRequest.flush(methodResponse);
});
- xit('should execute the get_system_handle action on the Cobbler Server', () => {
- service.get_system_handle('', '');
- expect(service).toBeFalsy();
+ it('should execute the get_system_handle action on the Cobbler Server', (done: DoneFn) => {
+ // eslint-disable-next-line max-len
+ const methodResponse = `distro::testdistro`
+ const result = "distro::testdistro"
+ service.get_system_handle("", "").subscribe(value => {
+ expect(value).toEqual(result)
+ done()
+ });
+ const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api');
+ mockRequest.flush(methodResponse);
});
- xit('should execute the get_repo_handle action on the Cobbler Server', () => {
- service.get_repo_handle('', '');
- expect(service).toBeFalsy();
+ it('should execute the get_repo_handle action on the Cobbler Server', (done: DoneFn) => {
+ // eslint-disable-next-line max-len
+ const methodResponse = `repo::testrepo`
+ const result = "repo::testrepo"
+ service.get_repo_handle("", "").subscribe(value => {
+ expect(value).toEqual(result)
+ done()
+ });
+ const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api');
+ mockRequest.flush(methodResponse);
});
- xit('should execute the get_image_handle action on the Cobbler Server', () => {
- service.get_image_handle('', '');
- expect(service).toBeFalsy();
+ it('should execute the get_image_handle action on the Cobbler Server', (done: DoneFn) => {
+ // eslint-disable-next-line max-len
+ const methodResponse = `image::testimage`
+ const result = "image::testimage"
+ service.get_image_handle("", "").subscribe(value => {
+ expect(value).toEqual(result)
+ done()
+ });
+ const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api');
+ mockRequest.flush(methodResponse);
});
- xit('should execute the get_mgmtclass_handle action on the Cobbler Server', () => {
- service.get_mgmtclass_handle('', '');
- expect(service).toBeFalsy();
+ it('should execute the get_mgmtclass_handle action on the Cobbler Server', (done: DoneFn) => {
+ // eslint-disable-next-line max-len
+ const methodResponse = `mgmtclass::testmgmtclass`
+ const result = "mgmtclass::testmgmtclass"
+ service.get_mgmtclass_handle("", "").subscribe(value => {
+ expect(value).toEqual(result)
+ done()
+ });
+ const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api');
+ mockRequest.flush(methodResponse);
});
- xit('should execute the get_package_handle action on the Cobbler Server', () => {
- service.get_package_handle('', '');
- expect(service).toBeFalsy();
+ it('should execute the get_package_handle action on the Cobbler Server', (done: DoneFn) => {
+ // eslint-disable-next-line max-len
+ const methodResponse = `package::testpackage`
+ const result = "package::testpackage"
+ service.get_package_handle("", "").subscribe(value => {
+ expect(value).toEqual(result)
+ done()
+ });
+ const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api');
+ mockRequest.flush(methodResponse);
});
- xit('should execute the get_file_handle action on the Cobbler Server', () => {
- service.get_file_handle('', '');
- expect(service).toBeFalsy();
+ it('should execute the get_file_handle action on the Cobbler Server', (done: DoneFn) => {
+ // eslint-disable-next-line max-len
+ const methodResponse = `file::testfile`
+ const result = "file::testfile"
+ service.get_file_handle("", "").subscribe(value => {
+ expect(value).toEqual(result)
+ done()
+ });
+ const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api');
+ mockRequest.flush(methodResponse);
});
xit('should execute the remove_item action on the Cobbler Server', () => {
@@ -533,44 +1327,100 @@ describe('CobblerApiService', () => {
expect(service).toBeFalsy();
});
- xit('should execute the remove_distro action on the Cobbler Server', () => {
- service.remove_distro('', '', true);
- expect(service).toBeFalsy();
+ it('should execute the remove_distro action on the Cobbler Server', (done: DoneFn) => {
+ // eslint-disable-next-line max-len
+ const methodResponse = `1`
+ const result = true
+ service.remove_distro("", "", false).subscribe(value => {
+ expect(value).toEqual(result)
+ done()
+ });
+ const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api');
+ mockRequest.flush(methodResponse);
});
- xit('should execute the remove_profile action on the Cobbler Server', () => {
- service.remove_profile('', '', true);
- expect(service).toBeFalsy();
+ it('should execute the remove_profile action on the Cobbler Server', (done: DoneFn) => {
+ // eslint-disable-next-line max-len
+ const methodResponse = `1`
+ const result = true
+ service.remove_profile("", "", false).subscribe(value => {
+ expect(value).toEqual(result)
+ done()
+ });
+ const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api');
+ mockRequest.flush(methodResponse);
});
- xit('should execute the remove_system action on the Cobbler Server', () => {
- service.remove_system('', '', true);
- expect(service).toBeFalsy();
+ it('should execute the remove_system action on the Cobbler Server', (done: DoneFn) => {
+ // eslint-disable-next-line max-len
+ const methodResponse = `1`
+ const result = true
+ service.remove_system("", "", false).subscribe(value => {
+ expect(value).toEqual(result)
+ done()
+ });
+ const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api');
+ mockRequest.flush(methodResponse);
});
- xit('should execute the remove_repo action on the Cobbler Server', () => {
- service.remove_repo('', '', true);
- expect(service).toBeFalsy();
+ it('should execute the remove_repo action on the Cobbler Server', (done: DoneFn) => {
+ // eslint-disable-next-line max-len
+ const methodResponse = `1`
+ const result = true
+ service.remove_repo("", "", false).subscribe(value => {
+ expect(value).toEqual(result)
+ done()
+ });
+ const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api');
+ mockRequest.flush(methodResponse);
});
- xit('should execute the remove_image action on the Cobbler Server', () => {
- service.remove_image('', '', true);
- expect(service).toBeFalsy();
+ it('should execute the remove_image action on the Cobbler Server', (done: DoneFn) => {
+ // eslint-disable-next-line max-len
+ const methodResponse = `1`
+ const result = true
+ service.remove_image("", "", false).subscribe(value => {
+ expect(value).toEqual(result)
+ done()
+ });
+ const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api');
+ mockRequest.flush(methodResponse);
});
- xit('should execute the remove_mgmtclass action on the Cobbler Server', () => {
- service.remove_mgmtclass('', '', true);
- expect(service).toBeFalsy();
+ it('should execute the remove_mgmtclass action on the Cobbler Server', (done: DoneFn) => {
+ // eslint-disable-next-line max-len
+ const methodResponse = `1`
+ const result = true
+ service.remove_mgmtclass("", "", false).subscribe(value => {
+ expect(value).toEqual(result)
+ done()
+ });
+ const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api');
+ mockRequest.flush(methodResponse);
});
- xit('should execute the remove_package action on the Cobbler Server', () => {
- service.remove_package('', '', true);
- expect(service).toBeFalsy();
+ it('should execute the remove_package action on the Cobbler Server', (done: DoneFn) => {
+ // eslint-disable-next-line max-len
+ const methodResponse = `1`
+ const result = true
+ service.remove_package("", "", false).subscribe(value => {
+ expect(value).toEqual(result)
+ done()
+ });
+ const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api');
+ mockRequest.flush(methodResponse);
});
- xit('should execute the remove_file action on the Cobbler Server', () => {
- service.remove_file('', '', true);
- expect(service).toBeFalsy();
+ it('should execute the remove_file action on the Cobbler Server', (done: DoneFn) => {
+ // eslint-disable-next-line max-len
+ const methodResponse = `1`
+ const result = true
+ service.remove_file("", "", false).subscribe(value => {
+ expect(value).toEqual(result)
+ done()
+ });
+ const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api');
+ mockRequest.flush(methodResponse);
});
xit('should execute the copy_item action on the Cobbler Server', () => {
@@ -578,44 +1428,100 @@ describe('CobblerApiService', () => {
expect(service).toBeFalsy();
});
- xit('should execute the copy_distro action on the Cobbler Server', () => {
- service.copy_distro('', '', '');
- expect(service).toBeFalsy();
+ it('should execute the copy_distro action on the Cobbler Server', (done: DoneFn) => {
+ // eslint-disable-next-line max-len
+ const methodResponse = `1`
+ const result = true
+ service.copy_distro("", "", "").subscribe(value => {
+ expect(value).toEqual(result)
+ done()
+ });
+ const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api');
+ mockRequest.flush(methodResponse);
});
- xit('should execute the copy_profile action on the Cobbler Server', () => {
- service.copy_profile('', '', '');
- expect(service).toBeFalsy();
+ it('should execute the copy_profile action on the Cobbler Server', (done: DoneFn) => {
+ // eslint-disable-next-line max-len
+ const methodResponse = `1`
+ const result = true
+ service.copy_profile("", "", "").subscribe(value => {
+ expect(value).toEqual(result)
+ done()
+ });
+ const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api');
+ mockRequest.flush(methodResponse);
});
- xit('should execute the copy_system action on the Cobbler Server', () => {
- service.copy_system('', '', '');
- expect(service).toBeFalsy();
+ it('should execute the copy_system action on the Cobbler Server', (done: DoneFn) => {
+ // eslint-disable-next-line max-len
+ const methodResponse = `1`
+ const result = true
+ service.copy_system("", "", "").subscribe(value => {
+ expect(value).toEqual(result)
+ done()
+ });
+ const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api');
+ mockRequest.flush(methodResponse);
});
- xit('should execute the copy_repo action on the Cobbler Server', () => {
- service.copy_repo('', '', '');
- expect(service).toBeFalsy();
+ it('should execute the copy_repo action on the Cobbler Server', (done: DoneFn) => {
+ // eslint-disable-next-line max-len
+ const methodResponse = `1`
+ const result = true
+ service.copy_repo("", "", "").subscribe(value => {
+ expect(value).toEqual(result)
+ done()
+ });
+ const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api');
+ mockRequest.flush(methodResponse);
});
- xit('should execute the copy_image action on the Cobbler Server', () => {
- service.copy_image('', '', '');
- expect(service).toBeFalsy();
+ it('should execute the copy_image action on the Cobbler Server', (done: DoneFn) => {
+ // eslint-disable-next-line max-len
+ const methodResponse = `1`
+ const result = true
+ service.copy_image("", "", "").subscribe(value => {
+ expect(value).toEqual(result)
+ done()
+ });
+ const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api');
+ mockRequest.flush(methodResponse);
});
- xit('should execute the copy_mgmtclass action on the Cobbler Server', () => {
- service.copy_mgmtclass('', '', '');
- expect(service).toBeFalsy();
+ it('should execute the copy_mgmtclass action on the Cobbler Server', (done: DoneFn) => {
+ // eslint-disable-next-line max-len
+ const methodResponse = `1`
+ const result = true
+ service.copy_mgmtclass("", "", "").subscribe(value => {
+ expect(value).toEqual(result)
+ done()
+ });
+ const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api');
+ mockRequest.flush(methodResponse);
});
- xit('should execute the copy_package action on the Cobbler Server', () => {
- service.copy_package('', '', '');
- expect(service).toBeFalsy();
+ it('should execute the copy_package action on the Cobbler Server', (done: DoneFn) => {
+ // eslint-disable-next-line max-len
+ const methodResponse = `1`
+ const result = true
+ service.copy_package("", "", "").subscribe(value => {
+ expect(value).toEqual(result)
+ done()
+ });
+ const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api');
+ mockRequest.flush(methodResponse);
});
- xit('should execute the copy_file action on the Cobbler Server', () => {
- service.copy_file('', '', '');
- expect(service).toBeFalsy();
+ it('should execute the copy_file action on the Cobbler Server', (done: DoneFn) => {
+ // eslint-disable-next-line max-len
+ const methodResponse = `1`
+ const result = true
+ service.copy_file("", "", "").subscribe(value => {
+ expect(value).toEqual(result)
+ done()
+ });
+ const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api');
+ mockRequest.flush(methodResponse);
});
xit('should execute the rename_item action on the Cobbler Server', () => {
@@ -623,44 +1529,100 @@ describe('CobblerApiService', () => {
expect(service).toBeFalsy();
});
- xit('should execute the rename_distro action on the Cobbler Server', () => {
- service.rename_distro('', '', '');
- expect(service).toBeFalsy();
+ it('should execute the rename_distro action on the Cobbler Server', (done: DoneFn) => {
+ // eslint-disable-next-line max-len
+ const methodResponse = `1`
+ const result = true
+ service.rename_distro("", "", "").subscribe(value => {
+ expect(value).toEqual(result)
+ done()
+ });
+ const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api');
+ mockRequest.flush(methodResponse);
});
- xit('should execute the rename_profile action on the Cobbler Server', () => {
- service.rename_profile('', '', '');
- expect(service).toBeFalsy();
+ it('should execute the rename_profile action on the Cobbler Server', (done: DoneFn) => {
+ // eslint-disable-next-line max-len
+ const methodResponse = `1`
+ const result = true
+ service.rename_profile("", "", "").subscribe(value => {
+ expect(value).toEqual(result)
+ done()
+ });
+ const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api');
+ mockRequest.flush(methodResponse);
});
- xit('should execute the rename_system action on the Cobbler Server', () => {
- service.rename_system('', '', '');
- expect(service).toBeFalsy();
+ it('should execute the rename_system action on the Cobbler Server', (done: DoneFn) => {
+ // eslint-disable-next-line max-len
+ const methodResponse = `1`
+ const result = true
+ service.rename_system("", "", "").subscribe(value => {
+ expect(value).toEqual(result)
+ done()
+ });
+ const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api');
+ mockRequest.flush(methodResponse);
});
- xit('should execute the rename_repo action on the Cobbler Server', () => {
- service.rename_repo('', '', '');
- expect(service).toBeFalsy();
+ it('should execute the rename_repo action on the Cobbler Server', (done: DoneFn) => {
+ // eslint-disable-next-line max-len
+ const methodResponse = `1`
+ const result = true
+ service.rename_repo("", "", "").subscribe(value => {
+ expect(value).toEqual(result)
+ done()
+ });
+ const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api');
+ mockRequest.flush(methodResponse);
});
- xit('should execute the rename_image action on the Cobbler Server', () => {
- service.rename_image('', '', '');
- expect(service).toBeFalsy();
+ it('should execute the rename_image action on the Cobbler Server', (done: DoneFn) => {
+ // eslint-disable-next-line max-len
+ const methodResponse = `1`
+ const result = true
+ service.rename_image("", "", "").subscribe(value => {
+ expect(value).toEqual(result)
+ done()
+ });
+ const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api');
+ mockRequest.flush(methodResponse);
});
- xit('should execute the rename_mgmtclass action on the Cobbler Server', () => {
- service.rename_mgmtclass('', '', '');
- expect(service).toBeFalsy();
+ it('should execute the rename_mgmtclass action on the Cobbler Server', (done: DoneFn) => {
+ // eslint-disable-next-line max-len
+ const methodResponse = `1`
+ const result = true
+ service.rename_mgmtclass("", "", "").subscribe(value => {
+ expect(value).toEqual(result)
+ done()
+ });
+ const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api');
+ mockRequest.flush(methodResponse);
});
- xit('should execute the rename_package action on the Cobbler Server', () => {
- service.rename_package('', '', '');
- expect(service).toBeFalsy();
+ it('should execute the rename_package action on the Cobbler Server', (done: DoneFn) => {
+ // eslint-disable-next-line max-len
+ const methodResponse = `1`
+ const result = true
+ service.rename_package("", "", "").subscribe(value => {
+ expect(value).toEqual(result)
+ done()
+ });
+ const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api');
+ mockRequest.flush(methodResponse);
});
- xit('should execute the rename_file action on the Cobbler Server', () => {
- service.rename_file('', '', '');
- expect(service).toBeFalsy();
+ it('should execute the rename_file action on the Cobbler Server', (done: DoneFn) => {
+ // eslint-disable-next-line max-len
+ const methodResponse = `1`
+ const result = true
+ service.rename_file("", "", "").subscribe(value => {
+ expect(value).toEqual(result)
+ done()
+ });
+ const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api');
+ mockRequest.flush(methodResponse);
});
xit('should execute the new_item action on the Cobbler Server', () => {
@@ -819,14 +1781,28 @@ describe('CobblerApiService', () => {
expect(service).toBeFalsy();
});
- xit('should execute the get_autoinstall_templates action on the Cobbler Server', () => {
- service.get_autoinstall_templates('');
- expect(service).toBeFalsy();
+ it('should execute the get_autoinstall_templates action on the Cobbler Server', () => {
+ // eslint-disable-next-line max-len
+ const methodResponse = `default.ksesxi4-ks.cfgesxi5-ks.cfglegacy.kspowerkvm.kspxerescue.kssample.kssample.seedsample_autoyast.xmlsample_esxi4.kssample_esxi5.kssample_esxi6.kssample_esxi7.kssample_legacy.kssample_old.seedwin.ks`
+ // eslint-disable-next-line max-len
+ const result = ["default.ks", "esxi4-ks.cfg", "esxi5-ks.cfg", "legacy.ks", "powerkvm.ks", "pxerescue.ks", "sample.ks", "sample.seed", "sample_autoyast.xml", "sample_esxi4.ks", "sample_esxi5.ks", "sample_esxi6.ks", "sample_esxi7.ks", "sample_legacy.ks", "sample_old.seed", "win.ks"]
+ service.get_autoinstall_templates("").subscribe(value => {
+ expect(value).toEqual(result)
+ });
+ const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api');
+ mockRequest.flush(methodResponse);
});
- xit('should execute the get_autoinstall_snippets action on the Cobbler Server', () => {
- service.get_autoinstall_snippets('');
- expect(service).toBeFalsy();
+ it('should execute the get_autoinstall_snippets action on the Cobbler Server', () => {
+ // eslint-disable-next-line max-len
+ const methodResponse = `addons.xmlautoinstall_doneautoinstall_startcobbler_registerdownload_config_filesdownload_config_files_debhosts.xmlkdump.xmlkeep_cfengine_keyskeep_fileskeep_rhn_keyskeep_rudder_keyskeep_rudder_uuidkeep_ssh_host_keyskoan_environmentlate_apt_repo_configlog_ks_postlog_ks_post_nochrootlog_ks_premain_partition_selectnetwork_confignetwork_config_esxnetwork_config_esxinetworking.xmlpartition_selectpost_anamonpost_install_kernel_optionspost_install_network_configpost_install_network_config_debpost_koan_add_reinstall_entrypost_run_debpre_anamonpre_install_network_configpre_partition_selectpreseed_apt_repo_configproxy.xmlpuppet_install_if_enabledpuppet_register_if_enabledredhat_registerrestore_boot_devicesave_boot_devicesuse_scriptwrapper.xml`
+ // eslint-disable-next-line max-len
+ const result = ['addons.xml', 'autoinstall_done', 'autoinstall_start', 'cobbler_register', 'download_config_files', 'download_config_files_deb', 'hosts.xml', 'kdump.xml', 'keep_cfengine_keys', 'keep_files', 'keep_rhn_keys', 'keep_rudder_keys', 'keep_rudder_uuid', 'keep_ssh_host_keys', 'koan_environment', 'late_apt_repo_config', 'log_ks_post', 'log_ks_post_nochroot', 'log_ks_pre', 'main_partition_select', 'network_config', 'network_config_esx', 'network_config_esxi', 'networking.xml', 'partition_select', 'post_anamon', 'post_install_kernel_options', 'post_install_network_config', 'post_install_network_config_deb', 'post_koan_add_reinstall_entry', 'post_run_deb', 'pre_anamon', 'pre_install_network_config', 'pre_partition_select', 'preseed_apt_repo_config', 'proxy.xml', 'puppet_install_if_enabled', 'puppet_register_if_enabled', 'redhat_register', 'restore_boot_device', 'save_boot_device', 'suse_scriptwrapper.xml']
+ service.get_autoinstall_snippets("").subscribe(value => {
+ expect(value).toEqual(result)
+ });
+ const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api');
+ mockRequest.flush(methodResponse);
});
xit('should execute the is_autoinstall_in_use action on the Cobbler Server', () => {
@@ -1191,34 +2167,82 @@ describe('CobblerApiService', () => {
mockRequest.flush(methodResponse);
});
- xit('should execute the read_autoinstall_template action on the Cobbler Server', () => {
- service.read_autoinstall_template('', '');
- expect(service).toBeFalsy();
+ it('should execute the read_autoinstall_template action on the Cobbler Server', (done: DoneFn) => {
+ // eslint-disable-next-line max-len
+ const methodResponse = `sample content`
+ const result = "sample content";
+ service.read_autoinstall_template('', '').subscribe(
+ value => {
+ expect(value).toEqual(result);
+ done();
+ });
+ const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api');
+ mockRequest.flush(methodResponse);
});
- xit('should execute the write_autoinstall_template action on the Cobbler Server', () => {
- service.write_autoinstall_template('', '', '');
- expect(service).toBeFalsy();
+ it('should execute the write_autoinstall_template action on the Cobbler Server', (done: DoneFn) => {
+ // eslint-disable-next-line max-len
+ const methodResponse = `1`
+ const result = true;
+ service.write_autoinstall_template('', '', '').subscribe(
+ value => {
+ expect(value).toEqual(result);
+ done();
+ });
+ const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api');
+ mockRequest.flush(methodResponse);
});
- xit('should execute the remove_autoinstall_template action on the Cobbler Server', () => {
- service.remove_autoinstall_template('', '');
- expect(service).toBeFalsy();
+ it('should execute the remove_autoinstall_template action on the Cobbler Server', (done: DoneFn) => {
+ // eslint-disable-next-line max-len
+ const methodResponse = `1`
+ const result = true;
+ service.remove_autoinstall_template('', '').subscribe(
+ value => {
+ expect(value).toEqual(result);
+ done();
+ });
+ const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api');
+ mockRequest.flush(methodResponse);
});
- xit('should execute the read_autoinstall_snippet action on the Cobbler Server', () => {
- service.read_autoinstall_snippet('', '');
- expect(service).toBeFalsy();
+ it('should execute the read_autoinstall_snippet action on the Cobbler Server', (done: DoneFn) => {
+ // eslint-disable-next-line max-len
+ const methodResponse = `sample content`
+ const result = "sample content";
+ service.read_autoinstall_snippet('', '',).subscribe(
+ value => {
+ expect(value).toEqual(result);
+ done();
+ });
+ const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api');
+ mockRequest.flush(methodResponse);
});
- xit('should execute the write_autoinstall_snippet action on the Cobbler Server', () => {
- service.write_autoinstall_snippet('', '', '');
- expect(service).toBeFalsy();
+ it('should execute the write_autoinstall_snippet action on the Cobbler Server', (done: DoneFn) => {
+ // eslint-disable-next-line max-len
+ const methodResponse = `1`
+ const result = true;
+ service.write_autoinstall_snippet('', '', '').subscribe(
+ value => {
+ expect(value).toEqual(result);
+ done();
+ });
+ const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api');
+ mockRequest.flush(methodResponse);
});
- xit('should execute the remove_autoinstall_snippet action on the Cobbler Server', () => {
- service.remove_autoinstall_snippet('', '');
- expect(service).toBeFalsy();
+ it('should execute the remove_autoinstall_snippet action on the Cobbler Server', (done: DoneFn) => {
+ // eslint-disable-next-line max-len
+ const methodResponse = `1`
+ const result = true;
+ service.remove_autoinstall_snippet('', '').subscribe(
+ value => {
+ expect(value).toEqual(result);
+ done();
+ });
+ const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api');
+ mockRequest.flush(methodResponse);
});
xit('should execute the get_config_data action on the Cobbler Server', () => {
diff --git a/projects/cobbler-api/src/lib/cobbler-api.service.ts b/projects/cobbler-api/src/lib/cobbler-api.service.ts
index a7e2f170..8189dd0e 100644
--- a/projects/cobbler-api/src/lib/cobbler-api.service.ts
+++ b/projects/cobbler-api/src/lib/cobbler-api.service.ts
@@ -454,6 +454,27 @@ export class CobblerApiService {
);
}
+ private rebuildItem(xmlrpcStruct: XmlRpcStruct): object {
+ const result = {}
+ xmlrpcStruct.members.forEach(value => {
+ if (value.name === "ks_meta" || value.name === "kickstart") {
+ // Skip legacy keys
+ return;
+ }
+ if (AngularXmlrpcService.instanceOfXmlRpcArray(value.value)) {
+ result[value.name] = this.convertXmlRpcArrayToTypeScriptArray(value.value)
+ } else if (AngularXmlrpcService.instanceOfXmlRpcStruct(value.value)) {
+ result[value.name] = this.convertXmlRpcStructToTypeScriptObject(value.value)
+ } else if (value.value === "<<inherit>>") {
+ // FIXME: Maybe we need to XML encode this as other strings potentially also could need encoding
+ result[value.name] = "<>"
+ } else {
+ result[value.name] = value.value
+ }
+ })
+ return result
+ }
+
// TODO: Create casting magic to output the right item type
get_item(what: string, name: string, flatten: boolean = false): Observable