def test_verify_bugzilla_1114640(self): """Create a parameter for operating system 1. :id: e817ae43-226c-44e3-b559-62b8d394047b :expectedresults: A parameter is created and can be read afterwards. :CaseImportance: Critical """ # Check whether OS 1 exists. os1 = entities.OperatingSystem(id=1).read_raw() if (os1.status_code == NOT_FOUND and entities.OperatingSystem().create().id != 1): self.skipTest( 'Cannot execute test, as operating system 1 is not available.') # Create and read a parameter for operating system 1. The purpose of # this test is to make sure an HTTP 422 is not returned, but we're also # going to verify the name and value of the parameter, just for good # measure. name = gen_string('utf8') value = gen_string('utf8') os_param = entities.OperatingSystemParameter( name=name, operatingsystem=1, value=value, ).create() self.assertEqual(os_param.name, name) self.assertEqual(os_param.value, value)
def test_positive_osparameter_read(self): """Create an OperatingSystemParameter and get it using ``nailgun.entity_mixins.EntityReadMixin.read``. :id: 1de63937-5ca1-4101-b4ee-4b398c66b630 :expectedresults: The just-read entity is an instance of the correct class. :CaseImportance: Critical """ os_id = entities.OperatingSystem().create_json()['id'] osp_id = entities.OperatingSystemParameter(operatingsystem=os_id).create_json()['id'] self.assertIsInstance( entities.OperatingSystemParameter(id=osp_id, operatingsystem=os_id).read(), entities.OperatingSystemParameter, )
def test_positive_osparameter_read(self): """Create an OperatingSystemParameter and get it using ``nailgun.entity_mixins.EntityReadMixin.read``. @Feature: Test multiple API paths @Assert: The just-read entity is an instance of the correct class. """ os_id = entities.OperatingSystem().create_json()['id'] osp_id = entities.OperatingSystemParameter( operatingsystem=os_id ).create_json()['id'] self.assertIsInstance( entities.OperatingSystemParameter( id=osp_id, operatingsystem=os_id, ).read(), entities.OperatingSystemParameter )