Files
dolibarr/test/hurl/api/setup/10_setup_modules.hurl
Jon Bendtsen 7fc9b253bf Reviving some old PR with API get, activate and disable modules (#35718)
* Reviving some old PR with API get, activate and disable modules

* expanding hurl test for setup wih some module tests

* return array, not object

* fix PHPStan on getmodules

* typecasting module functions to string

* instiating class DolibarrModule into an object so we can call functions on it

---------

Co-authored-by: Jon Bendtsen <xcodeauthor@jonb.dk>
2025-10-14 19:33:40 +02:00

84 lines
2.4 KiB
Plaintext

# Check module list
GET http://{{hostnport}}/api/index.php/setup/modules
HTTP 200
[Asserts]
jsonpath "$" count > 2
# Get all states for all modules
GET http://{{hostnport}}/api/index.php/setup/modules/status/all?status=all
HTTP 200
[Captures]
workflow_active: jsonpath "$['WORKFLOW']['active']"
[Asserts]
jsonpath "$.WORKFLOW.modName" == "modWorkflow"
jsonpath "$.WORKFLOW.origin" == "core"
jsonpath "$.WORKFLOW.active" matches /^\d{1}$/
jsonpath "$.WORKFLOW.publisher" == ""
jsonpath "$.WORKFLOW.version" == "dolibarr"
# Get active all modules
GET http://{{hostnport}}/api/index.php/setup/modules/status/all?status=active
HTTP 200
[Asserts]
jsonpath "$.*" count > 2
# Get disabled for all modules
GET http://{{hostnport}}/api/index.php/setup/modules/status/all?status=disabled
HTTP 200
[Asserts]
jsonpath "$.*" count > 2
# Get all states for all modules
GET http://{{hostnport}}/api/index.php/setup/modules/status/core?status=all
HTTP 200
[Asserts]
jsonpath "$.*" count > 2
# Get active all modules
GET http://{{hostnport}}/api/index.php/setup/modules/status/core?status=active
HTTP 200
[Asserts]
jsonpath "$.*" count > 2
# Get disabled for all modules
GET http://{{hostnport}}/api/index.php/setup/modules/status/core?status=disabled
HTTP 200
[Asserts]
jsonpath "$.*" count > 2
# Get all states for all modules
GET http://{{hostnport}}/api/index.php/setup/modules/status/external?status=all
HTTP 200
[Asserts]
jsonpath "$.*" count >= 0
# Get active all modules
GET http://{{hostnport}}/api/index.php/setup/modules/status/external?status=active
HTTP 200
[Asserts]
jsonpath "$.*" count >= 0
# Get disabled for all modules
GET http://{{hostnport}}/api/index.php/setup/modules/status/external?status=disabled
HTTP 200
[Asserts]
jsonpath "$.*" count >=0
PUT http://{{hostnport}}/api/index.php/setup/modules/foobar/disable
HTTP 404
{"error":{"code":404,"message":"Not Found: Module foobar not found"}}
PUT http://{{hostnport}}/api/index.php/setup/modules/foobar/enable
HTTP 404
{"error":{"code":404,"message":"Not Found: Module foobar not found"}}
# GET modules DOLAPIENTITY: 1
GET http://{{hostnport}}/api/index.php/setup/modules/status/all?status=all
DOLAPIENTITY: 1
HTTP 200
# GET modules DOLAPIENTITY: 2
GET http://{{hostnport}}/api/index.php/setup/modules/status/all?status=all
DOLAPIENTITY: 2
HTTP 401
{"error":{"code":401,"message":"Unauthorized: Error user not valid (not found with api key or bad status or bad validity dates) (conf->entity=2)"}}