@@ -21,6 +21,7 @@ let test_introduce_duplicate_repo_name () =
21
21
let name_description_1 = " description1" in
22
22
let binary_url = " https://repo.example.com" in
23
23
let binary_url_1 = " https://repo1.example.com" in
24
+ let binary_url_2 = " https://1.1.1.1/repository/enabled" in
24
25
let source_url = " https://repo-src.example.com" in
25
26
let source_url_1 = " https://repo-src1.example.com" in
26
27
let gpgkey_path = " " in
@@ -42,6 +43,14 @@ let test_introduce_duplicate_repo_name () =
42
43
Repository. introduce_bundle ~__context ~name_label
43
44
~name_description: name_description_1
44
45
|> ignore
46
+ ) ;
47
+ Alcotest. check_raises " test_introduce_duplicate_repo_name_3"
48
+ Api_errors. (Server_error (repository_already_exists, [Ref. string_of ref ]))
49
+ (fun () ->
50
+ Repository. introduce_remote_pool ~__context ~name_label
51
+ ~name_description: name_description_1 ~binary_url: binary_url_2
52
+ ~certificate: " "
53
+ |> ignore
45
54
)
46
55
47
56
let test_introduce_duplicate_binary_url () =
@@ -58,7 +67,7 @@ let test_introduce_duplicate_binary_url () =
58
67
Repository. introduce ~__context ~name_label ~name_description ~binary_url
59
68
~source_url ~update: true ~gpgkey_path
60
69
in
61
- Alcotest. check_raises " test_introduce_duplicate_binary_url "
70
+ Alcotest. check_raises " test_introduce_duplicate_binary_url_1 "
62
71
Api_errors. (Server_error (repository_already_exists, [Ref. string_of ref ]))
63
72
(fun () ->
64
73
Repository. introduce ~__context ~binary_url ~name_label: name_label_1
@@ -110,6 +119,59 @@ let test_introduce_duplicate_bundle_repo () =
110
119
|> ignore
111
120
)
112
121
122
+ let test_introduce_invalid_remote_pool_repo_url () =
123
+ let __context = T. make_test_database () in
124
+ let name_label = " name" in
125
+ let name_description = " description" in
126
+ let invalid_url_1 = " http://1.1.1.1/repository/enabled" in
127
+ let invalid_url_2 = " https://1.1.1.257/repository/enabled" in
128
+ let invalid_url_3 = " https://test.com/repository/enabled" in
129
+ let invalid_url_4 = " https://1.1.1.1/other" in
130
+ let invalid_url_5 = " https://1.1.1.1" in
131
+ let invalid_url_6 = " non-url" in
132
+ Alcotest. check_raises " test_introduce_invalid_remote_pool_repo_url_1"
133
+ Api_errors. (Server_error (invalid_base_url, [invalid_url_1]))
134
+ (fun () ->
135
+ Repository. introduce_remote_pool ~__context ~name_label ~name_description
136
+ ~binary_url: invalid_url_1 ~certificate: " "
137
+ |> ignore
138
+ ) ;
139
+ Alcotest. check_raises " test_introduce_invalid_remote_pool_repo_url_2"
140
+ Api_errors. (Server_error (invalid_base_url, [invalid_url_2]))
141
+ (fun () ->
142
+ Repository. introduce_remote_pool ~__context ~name_label ~name_description
143
+ ~binary_url: invalid_url_2 ~certificate: " "
144
+ |> ignore
145
+ ) ;
146
+ Alcotest. check_raises " test_introduce_invalid_remote_pool_repo_url_3"
147
+ Api_errors. (Server_error (invalid_base_url, [invalid_url_3]))
148
+ (fun () ->
149
+ Repository. introduce_remote_pool ~__context ~name_label ~name_description
150
+ ~binary_url: invalid_url_3 ~certificate: " "
151
+ |> ignore
152
+ ) ;
153
+ Alcotest. check_raises " test_introduce_invalid_remote_pool_repo_url_4"
154
+ Api_errors. (Server_error (invalid_base_url, [invalid_url_4]))
155
+ (fun () ->
156
+ Repository. introduce_remote_pool ~__context ~name_label ~name_description
157
+ ~binary_url: invalid_url_4 ~certificate: " "
158
+ |> ignore
159
+ ) ;
160
+ Alcotest. check_raises " test_introduce_invalid_remote_pool_repo_url_5"
161
+ Api_errors. (Server_error (invalid_base_url, [invalid_url_5]))
162
+ (fun () ->
163
+ Repository. introduce_remote_pool ~__context ~name_label ~name_description
164
+ ~binary_url: invalid_url_5 ~certificate: " "
165
+ |> ignore
166
+ ) ;
167
+ Alcotest. check_raises " test_introduce_invalid_remote_pool_repo_url_6"
168
+ Api_errors. (Server_error (invalid_base_url, [invalid_url_6]))
169
+ (fun () ->
170
+ Repository. introduce_remote_pool ~__context ~name_label ~name_description
171
+ ~binary_url: invalid_url_6 ~certificate: " "
172
+ |> ignore
173
+ )
174
+
113
175
let test =
114
176
[
115
177
( " test_introduce_duplicate_repo_name"
@@ -128,6 +190,10 @@ let test =
128
190
, `Quick
129
191
, test_introduce_duplicate_bundle_repo
130
192
)
193
+ ; ( " test_introduce_invalid_remote_pool_repo_url"
194
+ , `Quick
195
+ , test_introduce_invalid_remote_pool_repo_url
196
+ )
131
197
]
132
198
133
199
let () =
0 commit comments