def test_one_nonexistant(self): report_list = [] resource = common.find_one_resource_and_report(self.cib, "R-missing", report_list) self.assertIsNone(resource) assert_report_item_list_equal(report_list, [ fixture.report_not_found("R-missing", context_type="resources"), ])
def test_one_additional_search(self): report_list = [] resource = common.find_one_resource_and_report( self.cib, "R1", report_list, additional_search=self.additional_search, ) self.assertEqual("R1x", resource.attrib.get("id")) assert_report_item_list_equal(report_list, [])
def test_one_existing(self): report_list = [] resource = common.find_one_resource_and_report( self.cib, "R1", report_list ) self.assertEqual("R1", resource.attrib.get("id")) assert_report_item_list_equal( report_list, [] )
def test_one_additional_search(self): report_list = [] resource = common.find_one_resource_and_report( self.cib, "R1", report_list, additional_search=self.additional_search, ) self.assertEqual("R1x", resource.attrib.get("id")) assert_report_item_list_equal( report_list, [] )
def test_one_nonexistant(self): report_list = [] resource = common.find_one_resource_and_report( self.cib, "R-missing", report_list ) self.assertIsNone(resource) assert_report_item_list_equal( report_list, [ fixture.report_not_found("R-missing", context_type="resources"), ] )
def _get_resource_el(self, res_id: str) -> Element: # client of this class should ensure that res_id really exists in CIB, # so here we don't need to handle possible reports return common.find_one_resource_and_report(self._resources_section, res_id, [])
def test_one_existing(self): report_list = [] resource = common.find_one_resource_and_report(self.cib, "R1", report_list) self.assertEqual("R1", resource.attrib.get("id")) assert_report_item_list_equal(report_list, [])