Skip to content

Commit a157b24

Browse files
feat(geolcation): Change country scope to Country
1 parent 666e403 commit a157b24

File tree

5 files changed

+8
-13
lines changed

5 files changed

+8
-13
lines changed

.github/workflows/markdown.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
on:
2-
push:
32
workflow_dispatch:
43

54
name: Markdown files test and update

.github/workflows/test-suite.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,17 @@ jobs:
4848
cp .ddev/additional_docker_compose/docker-compose.crowdsec.yaml .ddev/docker-compose.crowdsec.yaml
4949
cp .ddev/additional_docker_compose/docker-compose.playwright.yaml .ddev/docker-compose.playwright.yaml
5050
ddev start
51-
ddev --version
52-
ddev exec php -v
53-
5451
5552
- name: Set BOUNCER_KEY and PROXY_IP env
5653
run: |
5754
echo "BOUNCER_KEY=$(ddev create-bouncer)" >> $GITHUB_ENV
5855
echo "PROXY_IP=$(ddev find-ip ddev-router)" >> $GITHUB_ENV
5956
57+
- name: Some DEBUG information
58+
run: |
59+
ddev --version
60+
ddev exec php -v
61+
ddev exec -s crowdsec crowdsec -version
6062
6163
- name: Clone PHP lib Crowdsec files
6264
uses: actions/checkout@v2
@@ -81,9 +83,8 @@ jobs:
8183
8284
8385
- name: Run PHP UNIT tests
84-
# ddev exec BOUNCER_KEY=${{ env.BOUNCER_KEY }} LAPI_URL=http://crowdsec:8080 MEMCACHED_DSN=memcached://memcached:11211 REDIS_DSN=redis://redis:6379 /usr/bin/php ./my-own-modules/crowdsec-php-lib/vendor/bin/phpunit --testdox --colors --exclude-group ignore ./my-own-modules/crowdsec-php-lib/tests/IpVerificationTest.php
8586
run: |
86-
ddev exec -s crowdsec crowdsec -version
87+
ddev exec BOUNCER_KEY=${{ env.BOUNCER_KEY }} LAPI_URL=http://crowdsec:8080 MEMCACHED_DSN=memcached://memcached:11211 REDIS_DSN=redis://redis:6379 /usr/bin/php ./my-own-modules/crowdsec-php-lib/vendor/bin/phpunit --testdox --colors --exclude-group ignore ./my-own-modules/crowdsec-php-lib/tests/IpVerificationTest.php
8788
ddev exec BOUNCER_KEY=${{ env.BOUNCER_KEY }} LAPI_URL=http://crowdsec:8080 /usr/bin/php ./my-own-modules/crowdsec-php-lib/vendor/bin/phpunit --testdox --colors --exclude-group ignore ./my-own-modules/crowdsec-php-lib/tests/GeolocationTest.php
8889
8990
- name: Prepare END TO END tests

src/Constants.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ class Constants
6868
public const GEOLOCATION_TYPE_MAXMIND = 'maxmind';
6969

7070
/** @var string The CrowdSec country scope for decisions */
71-
public const SCOPE_COUNTRY = 'country';
71+
public const SCOPE_COUNTRY = 'Country';
7272

7373
/** @var string The CrowdSec Ip scope for decisions */
7474
public const SCOPE_IP = 'Ip';

tests/GeolocationTest.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,5 @@ public function testCanVerifyIpAndCountryWithMaxmindInLiveMode(array $maxmindCon
9898
'Get decisions for a clean IP and bad country but with geolocation disabled'
9999
);
100100

101-
102-
103-
104-
105-
106101
}
107102
}

tests/WatcherClient.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public function setInitialState(): void
5454
$now = new DateTime();
5555
$this->addDecision($now, '12h', '+12 hours', TestHelpers::BAD_IP, 'captcha');
5656
$this->addDecision($now, '24h', '+24 hours', TestHelpers::BAD_IP.'/'.TestHelpers::IP_RANGE, 'ban');
57-
$this->addDecision($now, '24h', '+24 hours', TestHelpers::JAPAN, 'captcha', 'country');
57+
$this->addDecision($now, '24h', '+24 hours', TestHelpers::JAPAN, 'captcha', Constants::SCOPE_COUNTRY);
5858
}
5959

6060
/** Set the initial watcher state */

0 commit comments

Comments
 (0)