diff options
| author | Ben Straub <bs@github.com> | 2013-01-08 12:58:20 -0800 |
|---|---|---|
| committer | Ben Straub <bs@github.com> | 2013-01-09 13:31:17 -0800 |
| commit | ffb02b1630da85e063a816cc6dddcdc004a8ff72 (patch) | |
| tree | f8660cf4d0c99b7185b1428edc777c6f573b9041 /tests-clar/network | |
| parent | 252b24049cf7018ba80c736fda636c53c465fbd2 (diff) | |
| download | libgit2-ffb02b1630da85e063a816cc6dddcdc004a8ff72.tar.gz | |
Expose stock user/pass credential utility
Diffstat (limited to 'tests-clar/network')
| -rw-r--r-- | tests-clar/network/cred.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tests-clar/network/cred.c b/tests-clar/network/cred.c new file mode 100644 index 000000000..52920c3f2 --- /dev/null +++ b/tests-clar/network/cred.c @@ -0,0 +1,27 @@ +#include "clar_libgit2.h" + +#include "git2/transport.h" + +void test_network_cred__stock_userpass_validates_args(void) +{ + git_cred_stock_userpass_plaintext_payload payload = {0}; + + cl_git_fail(git_cred_stock_userpass_plaintext(NULL, NULL, 0, NULL)); + + payload.username = "user"; + cl_git_fail(git_cred_stock_userpass_plaintext(NULL, NULL, 0, &payload)); + + payload.username = NULL; + payload.username = "pass"; + cl_git_fail(git_cred_stock_userpass_plaintext(NULL, NULL, 0, &payload)); +} + +void test_network_cred__stock_userpass_validates_that_method_is_allowed(void) +{ + git_cred *cred; + git_cred_stock_userpass_plaintext_payload payload = {"user", "pass"}; + + cl_git_fail(git_cred_stock_userpass_plaintext(&cred, NULL, 0, &payload)); + cl_git_pass(git_cred_stock_userpass_plaintext(&cred, NULL, GIT_CREDTYPE_USERPASS_PLAINTEXT, &payload)); + git__free(cred); +} |
