summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorVadim Revyakin <vadimr@intel.com>2006-11-28 16:04:41 +0000
committerVadim Revyakin <vadimr@intel.com>2006-11-28 16:04:41 +0000
commit41a98fc25ad73d9e215a1a430a33386fc31be02d (patch)
tree8f324222fdd0e68c764210869d1e21de31df4428 /tests
parent99fd323042e4be42ec552fd95f4141f8c16ad51d (diff)
downloadwsmancli-41a98fc25ad73d9e215a1a430a33386fc31be02d.tar.gz
wsmancli-41a98fc25ad73d9e215a1a430a33386fc31be02d.tar.xz
wsmancli-41a98fc25ad73d9e215a1a430a33386fc31be02d.zip
Response header check is added to the tests
Diffstat (limited to 'tests')
-rw-r--r--tests/cunit/common.c25
-rw-r--r--tests/cunit/common.h4
-rw-r--r--tests/cunit/enumeration.c12
3 files changed, 33 insertions, 8 deletions
diff --git a/tests/cunit/common.c b/tests/cunit/common.c
index d55c9f9..c6df99c 100644
--- a/tests/cunit/common.c
+++ b/tests/cunit/common.c
@@ -46,6 +46,27 @@ int clean_test(void) {
return 0;
}
-void check_response_header(char *action) {
- }
+void check_response_header(WsXmlDocH doc, char *action) {
+ char *xp = NULL;
+
+ xp = ws_xml_get_xpath_value(doc, "s:Envelope/s:Header/wsa:To");
+ CU_ASSERT_PTR_NOT_NULL(xp);
+ if (xp != NULL) {
+ CU_ASSERT_STRING_EQUAL(xp,
+ "http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous");
+ }
+ u_free(xp);
+ xp = ws_xml_get_xpath_value(doc, "s:Envelope/s:Header/wsa:Action");
+ CU_ASSERT_PTR_NOT_NULL(xp);
+ if (xp != NULL && action != NULL) {
+ CU_ASSERT_STRING_EQUAL(xp, action);
+ }
+ u_free(xp);
+ xp = ws_xml_get_xpath_value(doc, "s:Envelope/s:Header/wsa:MessageId");
+ CU_ASSERT_PTR_NOT_NULL(xp);
+ u_free(xp);
+ xp = ws_xml_get_xpath_value(doc, "s:Envelope/s:Header/wsa:RelatesTo");
+ CU_ASSERT_PTR_NOT_NULL(xp);
+ u_free(xp);
+}
diff --git a/tests/cunit/common.h b/tests/cunit/common.h
index 0e3863c..7491223 100644
--- a/tests/cunit/common.h
+++ b/tests/cunit/common.h
@@ -3,6 +3,7 @@
#define _COMMON_H
#include <CUnit/Basic.h>
+#include "wsman-client-api.h"
typedef struct {
const char *server;
@@ -59,6 +60,7 @@ int add_transfer_put_tests(CU_pSuite ps);
int add_invoke_tests(CU_pSuite ps);
int add_pull_tests(CU_pSuite ps);
-void check_response_header(char *action);
+void check_response_header(WsXmlDocH doc, char *action);
+
#endif
diff --git a/tests/cunit/enumeration.c b/tests/cunit/enumeration.c
index 34807f6..b891653 100644
--- a/tests/cunit/enumeration.c
+++ b/tests/cunit/enumeration.c
@@ -61,6 +61,7 @@ static char *filters1[] = {
NULL, NULL
};
+
static char *filters2[] = {
"/s:Envelope/s:Body/wsen:EnumerateResponse/wsman:Items[1]/wsa:EndpointReference/wsa:Address",
NULL,
@@ -73,6 +74,7 @@ static char *filters3[] = {
NULL, NULL,
};
+
static TestData tests[] = {
{
"Enumeration with non existent Resource URI.",
@@ -93,7 +95,7 @@ static TestData tests[] = {
500,
FLAG_NONE,
0,
- &filters1,
+ filters1,
},
{
"Enumeration (Optimized)",
@@ -123,7 +125,7 @@ static TestData tests[] = {
FLAG_ENUMERATION_OPTIMIZATION | FLAG_ENUMERATION_ENUM_EPR |
FLAG_ENUMERATION_COUNT_ESTIMATION ,
200,
- &filters2,
+ filters2,
},
{
"Enumeration (Optimized/EPR)",
@@ -166,8 +168,7 @@ static TestData tests[] = {
200,
FLAG_ENUMERATION_COUNT_ESTIMATION,
0,
- &filters3,
-
+ filters3,
}, /*
{
"Enumeration with valid Resource URI.",
@@ -264,7 +265,8 @@ static void enumeration_test() {
} else {
goto RETURN;
}
-
+ check_response_header(enum_response,
+ "http://schemas.xmlsoap.org/ws/2004/09/enumeration/EnumerateResponse");
if (_debug) wsman_output(enum_response);
if (tests[i].filters == NULL) {