Skip to content

Commit

Permalink
test: replace mockserver with wiremock
Browse files Browse the repository at this point in the history
  • Loading branch information
gbicou committed Nov 22, 2024
1 parent 9a81884 commit b7fb398
Show file tree
Hide file tree
Showing 11 changed files with 258 additions and 380 deletions.
3 changes: 2 additions & 1 deletion .env.test
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ ADMIN_EMAIL="test@test.com"
ADMIN_PASSWORD="test"
ADMIN_TOKEN="test"
PUBLIC_URL="http://127.0.0.1:8055"
IMAGGA_API="http://imagga:1080"
IMAGGA_API="http://imagga:8080"
IMAGGA_TAGS_ENABLE=true
10 changes: 3 additions & 7 deletions docker-compose.test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,8 @@ services:
- ./:/directus/extensions/imagga
env_file: ".env.test"
imagga:
image: mockserver/mockserver:5.15.0
image: wiremock/wiremock:latest
ports:
- 1080:1080
environment:
MOCKSERVER_PROPERTY_FILE: /mocks/mockserver.properties
MOCKSERVER_INITIALIZATION_JSON_PATH: /mocks/imagga.json
MOCKSERVER_WATCH_INITIALIZATION_JSON: "true"
- 8080:8080
volumes:
- ./mocks:/mocks
- ./mocks:/home/wiremock
199 changes: 0 additions & 199 deletions mocks/imagga.json

This file was deleted.

134 changes: 134 additions & 0 deletions mocks/mappings/colors.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
{

"request": {
"method": "GET",
"url": "/colors",
"queryParameters": {
"image_upload_id": {
"equalTo": "i05e132196706b94b1d85efb5f3SaM1j"
}
}
},
"response": {
"status": 200,
"jsonBody": {
"result": {
"colors": {
"background_colors": [
{
"b": 47,
"closest_palette_color": "light bronze",
"closest_palette_color_html_code": "#8c5e37",
"closest_palette_color_parent": "skin",
"closest_palette_distance": 1.70506228322597,
"g": 92,
"html_code": "#8c5c2f",
"percent": 48.0033950805664,
"r": 140
},
{
"b": 146,
"closest_palette_color": "cerulean",
"closest_palette_color_html_code": "#0074a8",
"closest_palette_color_parent": "blue",
"closest_palette_distance": 5.53350780052479,
"g": 116,
"html_code": "#467492",
"percent": 39.0454025268555,
"r": 70
},
{
"b": 30,
"closest_palette_color": "dark bronze",
"closest_palette_color_html_code": "#542e0c",
"closest_palette_color_parent": "skin",
"closest_palette_distance": 5.47689735887696,
"g": 48,
"html_code": "#4f301e",
"percent": 12.9512014389038,
"r": 79
}
],
"color_percent_threshold": 1.75,
"color_variance": 36,
"foreground_colors": [
{
"b": 147,
"closest_palette_color": "larkspur",
"closest_palette_color_html_code": "#6e7e99",
"closest_palette_color_parent": "blue",
"closest_palette_distance": 8.60114706674971,
"g": 125,
"html_code": "#577d93",
"percent": 52.3429222106934,
"r": 87
},
{
"b": 145,
"closest_palette_color": "pewter",
"closest_palette_color_html_code": "#84898c",
"closest_palette_color_parent": "grey",
"closest_palette_distance": 1.75501013175431,
"g": 142,
"html_code": "#898e91",
"percent": 30.0293598175049,
"r": 137
},
{
"b": 42,
"closest_palette_color": "brownie",
"closest_palette_color_html_code": "#584039",
"closest_palette_color_parent": "brown",
"closest_palette_distance": 4.99189248709017,
"g": 58,
"html_code": "#593a2a",
"percent": 17.6277160644531,
"r": 89
}
],
"image_colors": [
{
"b": 146,
"closest_palette_color": "cerulean",
"closest_palette_color_html_code": "#0074a8",
"closest_palette_color_parent": "blue",
"closest_palette_distance": 7.85085588656478,
"g": 121,
"html_code": "#547992",
"percent": 48.3686981201172,
"r": 84
},
{
"b": 46,
"closest_palette_color": "light bronze",
"closest_palette_color_html_code": "#8c5e37",
"closest_palette_color_parent": "skin",
"closest_palette_distance": 3.05634270891355,
"g": 86,
"html_code": "#83562e",
"percent": 47.9353446960449,
"r": 131
},
{
"b": 46,
"closest_palette_color": "navy blue",
"closest_palette_color_html_code": "#2b2e43",
"closest_palette_color_parent": "navy blue",
"closest_palette_distance": 6.62790662069936,
"g": 27,
"html_code": "#1f1b2e",
"percent": 3.60131478309631,
"r": 31
}
],
"object_percentage": 20.790994644165
}
},
"status": {
"text": "",
"type": "success"
}
}
}

}
9 changes: 9 additions & 0 deletions mocks/mappings/index.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"request": {
"url": "/"
},
"response": {
"status": 200,
"body": "OK"
}
}
Loading

0 comments on commit b7fb398

Please sign in to comment.