4 static int test_login(const isds_error error
, struct isds_ctx
*context
,
5 const char *url
, const char *username
, const char *password
,
6 const char *certificate
, const char *key
) {
9 isds_login(context
, url
, username
, password
, certificate
, key
))
10 FAIL_TEST("Wrong return code");
16 static int test_login2(const isds_error error1
, const isds_error error2
,
17 struct isds_ctx
*context
,
18 const char *url
, const char *username
, const char *password
,
19 const char *certificate
, const char *key
) {
22 isds_login(context
, url
, username
, password
, certificate
, key
);
23 if (err
!= error1
&& err
!= error2
)
24 FAIL_TEST("Wrong return code");
31 int main(int argc
, char **argv
) {
34 struct isds_ctx
*context
= NULL
;
35 char url
[] = "https://www.czebox.cz/DS/";
36 char username
[] = "jrfh7i";
37 char password
[] = "Ac123456";
40 ABORT_UNIT("isds_init() failed\n");
41 context
= isds_ctx_create();
43 ABORT_UNIT("isds_ctx_create() failed\n");
46 TEST("invalid context", test_login
, IE_INVALID_CONTEXT
, NULL
,
47 url
, username
, password
, NULL
, NULL
);
48 TEST("NULL url", test_login
, IE_INVAL
, context
,
49 NULL
, username
, password
, NULL
, NULL
);
50 TEST("NULL username", test_login
, IE_INVAL
, context
,
51 url
, NULL
, password
, NULL
, NULL
);
52 TEST("NULL password", test_login
, IE_INVAL
, context
,
53 url
, username
, NULL
, NULL
, NULL
);
55 TEST("invalid URL", test_login
, IE_NETWORK
, context
,
56 "invalid://", username
, password
, NULL
, NULL
);
57 /* Direct connection fails on local resolution, connection trough proxy
58 * failes on HTTP code */
59 TEST("unresolvable host name", test_login2
, IE_NETWORK
, IE_SOAP
, context
,
60 "http://unresolvable.example.com/", username
, password
,
63 TEST("invalid credentials", test_login
, IE_NOT_LOGGED_IN
, context
,
64 url
, "7777777", "nbuusr1", NULL
, NULL
);
66 TEST("valid login", test_login
, IE_SUCCESS
, context
,
67 url
, username
, password
, NULL
, NULL
);
69 isds_ctx_free(&context
);