def createHardwareProfile(self, hwProfile: HardwareProfile, settingsDict: Optional[Union[dict, None]] = None): """ Create hardware profile from template Returns: None Throws: TortugaException """ url = 'hardwareprofiles/' postdata = { 'hardwareProfile': hwProfile.getCleanDict(), 'settingsDict': settingsDict, } try: responseDict = self.post(url, postdata) return responseDict except TortugaException as ex: raise except Exception as ex: raise TortugaException(exception=ex)
def test_serialization(): hp = HardwareProfile() hp.setName('test') hp.setDefaultResourceAdapterConfig('resadapterconfig') hp_dict = hp.getCleanDict() assert hp_dict['name'] == 'test' assert 'default_resource_adapter_config' in hp_dict