Skip to content

Commit

Permalink
MDL-79121 lib: improve the data provider of test_is_proxybypass method
Browse files Browse the repository at this point in the history
  • Loading branch information
jboulen committed Nov 11, 2024
1 parent 526f630 commit 4c5b2ba
Showing 1 changed file with 24 additions and 14 deletions.
38 changes: 24 additions & 14 deletions lib/tests/moodlelib_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -5416,72 +5416,82 @@ public function is_proxybypass_provider(): array {
'Proxybypass contains the same IP as the beginning of the URL' => [
'http://192.168.5.5-fake-app-7f000101.nip.io',
'192.168.5.5,127.0.0.1',
false
false,
],
'Proxybypass contains some extra whitespaces (test with hostname)' => [
'store.mydomain.com',
'store.mydomain.com , 192.168.5.5',
false,
],
'Proxybypass contains some extra whitespaces (test with IP)' => [
'192.168.5.5',
'store.mydomain.com , 192.168.5.5',
false,
],
'Proxybypass contains the last part of the URL' => [
'http://192.168.5.5-fake-app-7f000101.nip.io',
'app-7f000101.nip.io',
false
false,
],
'Proxybypass contains the last part of the URL 2' => [
'http://store.mydomain.com',
'mydomain.com',
false
false,
],
'Proxybypass contains part of the url' => [
'http://myweb.com',
'store.myweb.com',
false
false,
],
'Proxybypass with a wildcard contains part of the url' => [
'http://myweb.com',
'*.myweb.com',
false
false,
],
'Different IPs used in proxybypass' => [
'http://192.168.5.5',
'192.168.5.3',
false
false,
],
'Different partial IPs used in proxybypass' => [
'http://192.168.5.5',
'192.16',
false
false,
],
'Different partial IPs used in proxybypass with ending dot' => [
'http://192.168.5.5',
'192.16.',
false
false,
],
'Proxybypass and URL matchs' => [
'http://store.mydomain.com',
'store.mydomain.com',
true
true,
],
'Proxybypass with a wildcard value covers any subdomain' => [
'http://store.mydomain.com',
'*.mydomain.com',
true
true,
],
'Proxybypass with a wildcard value covers any higher level subdomain' => [
'http://another.store.mydomain.com',
'*.mydomain.com',
true
true,
],
'Proxybypass with multiple domains' => [
'http://store.mydomain.com',
'127.0.0.1,*.mydomain.com',
true
true,
],
'IP used in proxybypass' => [
'http://192.168.5.5',
'192.168.5.5',
true
true,
],
'Partial IP used in proxybypass' => [
'http://192.168.5.5',
'192.168.',
true
true,
],
];
}
Expand Down

0 comments on commit 4c5b2ba

Please sign in to comment.