Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
git2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
git2
Commits
85acc562
Commit
85acc562
authored
Aug 29, 2014
by
Carlos Martín Nieto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remote: add tests for the certificate callback
parent
ec1ce458
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
0 deletions
+35
-0
tests/online/clone.c
+35
-0
No files found.
tests/online/clone.c
View file @
85acc562
...
...
@@ -469,3 +469,38 @@ void test_online_clone__url_with_no_path_returns_EINVALIDSPEC(void)
cl_git_fail_with
(
git_clone
(
&
g_repo
,
"http://github.com"
,
"./foo"
,
&
g_options
),
GIT_EINVALIDSPEC
);
}
static
int
fail_certificate_check
(
git_cert_t
type
,
void
*
data
,
size_t
len
,
void
*
payload
)
{
GIT_UNUSED
(
type
);
GIT_UNUSED
(
data
);
GIT_UNUSED
(
len
);
GIT_UNUSED
(
payload
);
return
GIT_EUSER
;
}
void
test_online_clone__certificate_invalid
(
void
)
{
g_options
.
remote_callbacks
.
certificate_check
=
fail_certificate_check
;
cl_git_fail_with
(
git_clone
(
&
g_repo
,
"http://github.com/libgit2/TestGitRepository"
,
"./foo"
,
&
g_options
),
GIT_EUSER
);
}
static
int
succeed_certificate_check
(
git_cert_t
type
,
void
*
data
,
size_t
len
,
void
*
payload
)
{
GIT_UNUSED
(
type
);
GIT_UNUSED
(
data
);
GIT_UNUSED
(
len
);
GIT_UNUSED
(
payload
);
return
0
;
}
void
test_online_clone__certificate_valid
(
void
)
{
g_options
.
remote_callbacks
.
certificate_check
=
succeed_certificate_check
;
cl_git_pass
(
git_clone
(
&
g_repo
,
"http://github.com/libgit2/TestGitRepository"
,
"./foo"
,
&
g_options
));
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment