17 static char *cib_path = NULL;
20 setup_test(
void **state)
24 if (cib_path == NULL) {
32 teardown_test(
void **state)
40 bad_arguments(
void **state)
57 unknown_ticket(
void **state)
76 verify_results(xmlNode *xml,
const char *ticket_id,
const char *attr_name,
77 const char *attr_value)
80 xmlXPathObject *xpath_obj = NULL;
86 assert_int_equal(numXpathResults(xpath_obj), 1);
97 assert_int_equal(numXpathResults(xpath_obj), 1);
107 attribute_exists(
void **state)
114 verify_results(xml,
"ticketA",
"owner",
"1");
120 default_no_ticket(
void **state)
127 verify_results(xml,
"ticketX",
"ABC",
"DEFAULT");
133 default_no_attribute(
void **state)
140 verify_results(xml,
"ticketA",
"ABC",
"DEFAULT");
146 cmocka_unit_test_setup_teardown(bad_arguments, setup_test, teardown_test),
147 cmocka_unit_test_setup_teardown(unknown_ticket, setup_test, teardown_test),
148 cmocka_unit_test_setup_teardown(attribute_exists, setup_test, teardown_test),
149 cmocka_unit_test_setup_teardown(default_no_ticket, setup_test, teardown_test),
150 cmocka_unit_test_setup_teardown(default_no_attribute, setup_test, teardown_test))
#define PCMK_XE_PACEMAKER_RESULT
int pcmk_ticket_get_attr(xmlNodePtr *xml, const char *ticket_id, const char *attr_name, const char *attr_default)
Return the value of a ticket's attribute.
#define PCMK__UNIT_TEST(group_setup, group_teardown,...)
#define PCMK_XE_ATTRIBUTE
const char * crm_element_value(const xmlNode *data, const char *name)
Retrieve the value of an XML attribute.
int pcmk__xml_test_setup_group(void **state)
Wrappers for and extensions to libxml2.
void free_xml(xmlNode *child)
void pcmk__cib_test_cleanup(char *out_path)
xmlXPathObjectPtr xpath_search(const xmlNode *xml_top, const char *path)
void pcmk__assert_validates(xmlNode *xml)
char * pcmk__cib_test_copy_cib(const char *in_file)
xmlNode * getXpathResult(xmlXPathObjectPtr xpathObj, int index)
void freeXpathObject(xmlXPathObjectPtr xpathObj)