Commit 3680f0bf by Edward Thomson

tests: create the network::url test hierarcy

parent 1196de4f
...@@ -4,19 +4,19 @@ ...@@ -4,19 +4,19 @@
static git_net_url source, target; static git_net_url source, target;
void test_network_joinpath__initialize(void) void test_network_url_joinpath__initialize(void)
{ {
memset(&source, 0, sizeof(source)); memset(&source, 0, sizeof(source));
memset(&target, 0, sizeof(target)); memset(&target, 0, sizeof(target));
} }
void test_network_joinpath__cleanup(void) void test_network_url_joinpath__cleanup(void)
{ {
git_net_url_dispose(&source); git_net_url_dispose(&source);
git_net_url_dispose(&target); git_net_url_dispose(&target);
} }
void test_network_joinpath__target_paths_and_queries(void) void test_network_url_joinpath__target_paths_and_queries(void)
{ {
cl_git_pass(git_net_url_parse(&source, "http://example.com/a/b")); cl_git_pass(git_net_url_parse(&source, "http://example.com/a/b"));
...@@ -31,7 +31,7 @@ void test_network_joinpath__target_paths_and_queries(void) ...@@ -31,7 +31,7 @@ void test_network_joinpath__target_paths_and_queries(void)
git_net_url_dispose(&target); git_net_url_dispose(&target);
} }
void test_network_joinpath__source_query_removed(void) void test_network_url_joinpath__source_query_removed(void)
{ {
cl_git_pass(git_net_url_parse(&source, "http://example.com/a/b?query&one&two")); cl_git_pass(git_net_url_parse(&source, "http://example.com/a/b?query&one&two"));
...@@ -46,7 +46,7 @@ void test_network_joinpath__source_query_removed(void) ...@@ -46,7 +46,7 @@ void test_network_joinpath__source_query_removed(void)
git_net_url_dispose(&target); git_net_url_dispose(&target);
} }
void test_network_joinpath__source_lacks_path(void) void test_network_url_joinpath__source_lacks_path(void)
{ {
cl_git_pass(git_net_url_parse(&source, "http://example.com")); cl_git_pass(git_net_url_parse(&source, "http://example.com"));
...@@ -91,7 +91,7 @@ void test_network_joinpath__source_lacks_path(void) ...@@ -91,7 +91,7 @@ void test_network_joinpath__source_lacks_path(void)
git_net_url_dispose(&target); git_net_url_dispose(&target);
} }
void test_network_joinpath__source_is_slash(void) void test_network_url_joinpath__source_is_slash(void)
{ {
cl_git_pass(git_net_url_parse(&source, "http://example.com/")); cl_git_pass(git_net_url_parse(&source, "http://example.com/"));
...@@ -137,7 +137,7 @@ void test_network_joinpath__source_is_slash(void) ...@@ -137,7 +137,7 @@ void test_network_joinpath__source_is_slash(void)
} }
void test_network_joinpath__source_has_query(void) void test_network_url_joinpath__source_has_query(void)
{ {
cl_git_pass(git_net_url_parse(&source, "http://example.com?query")); cl_git_pass(git_net_url_parse(&source, "http://example.com?query"));
...@@ -183,7 +183,7 @@ void test_network_joinpath__source_has_query(void) ...@@ -183,7 +183,7 @@ void test_network_joinpath__source_has_query(void)
} }
void test_network_joinpath__empty_query_ignored(void) void test_network_url_joinpath__empty_query_ignored(void)
{ {
cl_git_pass(git_net_url_parse(&source, "http://example.com/foo")); cl_git_pass(git_net_url_parse(&source, "http://example.com/foo"));
......
...@@ -4,17 +4,17 @@ ...@@ -4,17 +4,17 @@
static git_net_url conndata; static git_net_url conndata;
void test_network_redirect__initialize(void) void test_network_url_redirect__initialize(void)
{ {
memset(&conndata, 0, sizeof(conndata)); memset(&conndata, 0, sizeof(conndata));
} }
void test_network_redirect__cleanup(void) void test_network_url_redirect__cleanup(void)
{ {
git_net_url_dispose(&conndata); git_net_url_dispose(&conndata);
} }
void test_network_redirect__redirect_http(void) void test_network_url_redirect__redirect_http(void)
{ {
cl_git_pass(git_net_url_parse(&conndata, cl_git_pass(git_net_url_parse(&conndata,
"http://example.com/foo/bar/baz")); "http://example.com/foo/bar/baz"));
...@@ -28,7 +28,7 @@ void test_network_redirect__redirect_http(void) ...@@ -28,7 +28,7 @@ void test_network_redirect__redirect_http(void)
cl_assert_equal_p(conndata.password, NULL); cl_assert_equal_p(conndata.password, NULL);
} }
void test_network_redirect__redirect_ssl(void) void test_network_url_redirect__redirect_ssl(void)
{ {
cl_git_pass(git_net_url_parse(&conndata, cl_git_pass(git_net_url_parse(&conndata,
"https://example.com/foo/bar/baz")); "https://example.com/foo/bar/baz"));
...@@ -42,7 +42,7 @@ void test_network_redirect__redirect_ssl(void) ...@@ -42,7 +42,7 @@ void test_network_redirect__redirect_ssl(void)
cl_assert_equal_p(conndata.password, NULL); cl_assert_equal_p(conndata.password, NULL);
} }
void test_network_redirect__redirect_leaves_root_path(void) void test_network_url_redirect__redirect_leaves_root_path(void)
{ {
cl_git_pass(git_net_url_parse(&conndata, cl_git_pass(git_net_url_parse(&conndata,
"https://example.com/foo/bar/baz")); "https://example.com/foo/bar/baz"));
...@@ -56,7 +56,7 @@ void test_network_redirect__redirect_leaves_root_path(void) ...@@ -56,7 +56,7 @@ void test_network_redirect__redirect_leaves_root_path(void)
cl_assert_equal_p(conndata.password, NULL); cl_assert_equal_p(conndata.password, NULL);
} }
void test_network_redirect__redirect_encoded_username_password(void) void test_network_url_redirect__redirect_encoded_username_password(void)
{ {
cl_git_pass(git_net_url_parse(&conndata, cl_git_pass(git_net_url_parse(&conndata,
"https://user%2fname:pass%40word%zyx%v@example.com/foo/bar/baz")); "https://user%2fname:pass%40word%zyx%v@example.com/foo/bar/baz"));
...@@ -70,7 +70,7 @@ void test_network_redirect__redirect_encoded_username_password(void) ...@@ -70,7 +70,7 @@ void test_network_redirect__redirect_encoded_username_password(void)
cl_assert_equal_s(conndata.password, "pass@word%zyx%v"); cl_assert_equal_s(conndata.password, "pass@word%zyx%v");
} }
void test_network_redirect__redirect_cross_host_denied(void) void test_network_url_redirect__redirect_cross_host_denied(void)
{ {
cl_git_pass(git_net_url_parse(&conndata, "https://bar.com/bar/baz")); cl_git_pass(git_net_url_parse(&conndata, "https://bar.com/bar/baz"));
cl_git_fail_with(git_net_url_apply_redirect(&conndata, cl_git_fail_with(git_net_url_apply_redirect(&conndata,
...@@ -78,7 +78,7 @@ void test_network_redirect__redirect_cross_host_denied(void) ...@@ -78,7 +78,7 @@ void test_network_redirect__redirect_cross_host_denied(void)
-1); -1);
} }
void test_network_redirect__redirect_http_downgrade_denied(void) void test_network_url_redirect__redirect_http_downgrade_denied(void)
{ {
cl_git_pass(git_net_url_parse(&conndata, "https://foo.com/bar/baz")); cl_git_pass(git_net_url_parse(&conndata, "https://foo.com/bar/baz"));
cl_git_fail_with(git_net_url_apply_redirect(&conndata, cl_git_fail_with(git_net_url_apply_redirect(&conndata,
...@@ -86,7 +86,7 @@ void test_network_redirect__redirect_http_downgrade_denied(void) ...@@ -86,7 +86,7 @@ void test_network_redirect__redirect_http_downgrade_denied(void)
-1); -1);
} }
void test_network_redirect__redirect_relative(void) void test_network_url_redirect__redirect_relative(void)
{ {
cl_git_pass(git_net_url_parse(&conndata, "http://foo.com/bar/baz/biff")); cl_git_pass(git_net_url_parse(&conndata, "http://foo.com/bar/baz/biff"));
cl_git_pass(git_net_url_apply_redirect(&conndata, cl_git_pass(git_net_url_apply_redirect(&conndata,
...@@ -99,7 +99,7 @@ void test_network_redirect__redirect_relative(void) ...@@ -99,7 +99,7 @@ void test_network_redirect__redirect_relative(void)
cl_assert_equal_p(conndata.password, NULL); cl_assert_equal_p(conndata.password, NULL);
} }
void test_network_redirect__redirect_relative_ssl(void) void test_network_url_redirect__redirect_relative_ssl(void)
{ {
cl_git_pass(git_net_url_parse(&conndata, "https://foo.com/bar/baz/biff")); cl_git_pass(git_net_url_parse(&conndata, "https://foo.com/bar/baz/biff"));
cl_git_pass(git_net_url_apply_redirect(&conndata, cl_git_pass(git_net_url_apply_redirect(&conndata,
...@@ -112,7 +112,7 @@ void test_network_redirect__redirect_relative_ssl(void) ...@@ -112,7 +112,7 @@ void test_network_redirect__redirect_relative_ssl(void)
cl_assert_equal_p(conndata.password, NULL); cl_assert_equal_p(conndata.password, NULL);
} }
void test_network_redirect__service_query_no_query_params_in_location(void) void test_network_url_redirect__service_query_no_query_params_in_location(void)
{ {
cl_git_pass(git_net_url_parse(&conndata, "https://foo.com/bar/info/refs?service=git-upload-pack")); cl_git_pass(git_net_url_parse(&conndata, "https://foo.com/bar/info/refs?service=git-upload-pack"));
cl_git_pass(git_net_url_apply_redirect(&conndata, cl_git_pass(git_net_url_apply_redirect(&conndata,
...@@ -120,7 +120,7 @@ void test_network_redirect__service_query_no_query_params_in_location(void) ...@@ -120,7 +120,7 @@ void test_network_redirect__service_query_no_query_params_in_location(void)
cl_assert_equal_s(conndata.path, "/baz"); cl_assert_equal_s(conndata.path, "/baz");
} }
void test_network_redirect__service_query_with_query_params_in_location(void) void test_network_url_redirect__service_query_with_query_params_in_location(void)
{ {
cl_git_pass(git_net_url_parse(&conndata, "https://foo.com/bar/info/refs?service=git-upload-pack")); cl_git_pass(git_net_url_parse(&conndata, "https://foo.com/bar/info/refs?service=git-upload-pack"));
cl_git_pass(git_net_url_apply_redirect(&conndata, cl_git_pass(git_net_url_apply_redirect(&conndata,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment