@@ -2,17 +2,9 @@ open Test_helpers
22open Auto_detection
33open Alcotest
44
5- (* * Test GitLab info detection - should fallback to default domain if not found
6- *)
75let test_auto_detect_gitlab_info () =
86 (* Test with real GitLab API if credentials are available, otherwise use mock *)
9- let bot_info =
10- match create_real_bot_info () with
11- | Some info ->
12- info (* Use real credentials if available *)
13- | None ->
14- create_mock_bot_info () (* Fallback to mock *)
15- in
7+ let bot_info = get_bot_info () in
168 let owner = " test-org" in
179 let repo = " test-repo" in
1810 let result =
@@ -30,12 +22,12 @@ let test_auto_detect_gitlab_info () =
3022
3123(* * Test org/team detection with real API or graceful skip *)
3224let test_auto_detect_org_team () =
33- (* Test with real GitHub API if credentials are available *)
34- match create_real_bot_info () with
25+ let bot_info = get_bot_info () in
26+ (* Skip test if no real credentials - this is expected in CI without secrets *)
27+ match bot_info.github_install_token with
3528 | None ->
36- (* Skip test if no credentials - this is expected in CI without secrets *)
3729 Alcotest. skip ()
38- | Some bot_info -> (
30+ | Some _ -> (
3931 (* Use a real public repository for testing that is known to exist *)
4032 let owner = " ocaml" in
4133 let repo = " opam" in
@@ -63,12 +55,12 @@ let test_auto_detect_org_team () =
6355
6456(* * Test complete auto-detection with caching *)
6557let test_auto_detect_from_apis () =
66- (* Test with real GitHub API if credentials are available *)
67- match create_real_bot_info () with
58+ let bot_info = get_bot_info () in
59+ (* Skip test if no real credentials *)
60+ match bot_info.github_install_token with
6861 | None ->
69- (* Skip test if no credentials - this is expected in CI without secrets *)
7062 Alcotest. skip ()
71- | Some bot_info ->
63+ | Some _ ->
7264 (* Use a real public repository for testing *)
7365 let owner = " ocaml" in
7466 let repo = " opam" in
@@ -102,10 +94,12 @@ let test_auto_detect_from_apis () =
10294
10395(* * Test that auto_detect_from_apis returns a complete Repo_config.t *)
10496let test_auto_detect_from_apis_completeness () =
105- match create_real_bot_info () with
97+ let bot_info = get_bot_info () in
98+ (* Skip test if no real credentials *)
99+ match bot_info.github_install_token with
106100 | None ->
107101 Alcotest. skip ()
108- | Some bot_info ->
102+ | Some _ ->
109103 let owner = " ocaml" in
110104 let repo = " opam" in
111105 Cache. clear_all () ;
@@ -124,8 +118,6 @@ let test_auto_detect_from_apis_completeness () =
124118 check bool " org_name is Some" (Option. is_some result.org_name) true ;
125119 (* team_name should be Some *)
126120 check bool " team_name is Some" (Option. is_some result.team_name) true ;
127- (* minimizer_url may be Some (if BOT_MINIMIZER_URL env var is set) or None (generic default) *)
128- (* This is acceptable - minimizer_url is optional and can be configured per-repo *)
129121 (* ci_config should be Some (from defaults) *)
130122 check bool " ci_config is Some" (Option. is_some result.ci_config) true
131123
0 commit comments