Skip to content

[4.0] Increase API Test Coverage#26722

Merged
zero-24 merged 22 commits intojoomla:4.0-devfrom
wilsonge:feature/api-tests
Sep 1, 2020
Merged

[4.0] Increase API Test Coverage#26722
zero-24 merged 22 commits intojoomla:4.0-devfrom
wilsonge:feature/api-tests

Conversation

@wilsonge
Copy link
Contributor

@wilsonge wilsonge commented Oct 19, 2019

Continues work on adding tests for our APIs in J4

Testing instructions

Try creating a category for a extension that is not com_content (contact or banners). Before patch you’ll get an error that the workflow is missing (despite banners doesn’t have workflows). After patch you can correctly create a category.

This PR also adds many api cases for banners, contacts and category api tests for content check that the api tests pass in drone

@C-Lodder
Copy link
Member

@wilsonge Is the DELETE method working for you? Drone is showing a 404 so I can't see the results of the PR, but when testing via JS, I'm getting:

500 - Internal server error

@wilsonge
Copy link
Contributor Author

Honestly I don't remember. This is the second time I'd attempted this PR - the original tests date back 2-3 years. I've just rebased and pushed up which should retrigger drone

@wilsonge
Copy link
Contributor Author

@C-Lodder works fine. However you need to update the status of the article to trashed with a patch request before deleting else you get a 500 (we need to improve the error message but functionally it works)

@C-Lodder
Copy link
Member

Ahh fair enough. Will give that a go.

Is that approach going to be set in stone for V1 of the API?

@wilsonge
Copy link
Contributor Author

Not really. For articles I specifically skipped the check of ensuring an item was in trash for the api. Unsure whether to go with that approach or not. ( see https://github.com/joomla/joomla-cms/blob/4.0-dev/administrator/components/com_content/src/Model/ArticleModel.php#L301 ).

@C-Lodder
Copy link
Member

I'd suggest keeping it consitent with other component APIs.

@wilsonge wilsonge marked this pull request as ready for review August 28, 2020 15:07
@wilsonge
Copy link
Contributor Author

Oh for sure. I more meant I hadn’t really settled on which was best

@astridx
Copy link
Contributor

astridx commented Aug 28, 2020

I have tested this. Creating a category was fine for com_banners and for one of my own components. The picture shows. On branch 4.0-dev i get the error. The same query was successful on the branch of this PR.
Screenshot from 2020 08 28 21 26 11

@astridx
Copy link
Contributor

astridx commented Aug 28, 2020

I am not sure with the tests.

i can run codeception tests for administor:


/var/www/html/joomla-cms4$ libraries/vendor/bin/codecept run acceptance tests/Codeception/acceptance/administrator/
Codeception PHP Testing Framework v4.1.6
Powered by PHPUnit 8.5.8 by Sebastian Bergmann and contributors.
Running with seed: 


Acceptance Tests (39) ----------------------------------------------------------------------------------------------------------
✔ ContentCategoryListCest: Category (8.94s)
✔ ContentFieldListCest: Field (13.49s)
✔ ContentListCest: Test that it loads without php notices and warnings. (0.95s)
✔ ContentListCest: Test that it is possible to create a new articles using "new" toolbar button. (44.05s)
✔ MediaListCest: Test that it loads without php notices and warnings. (0.80s)
✔ MediaListCest: Test that it shows the joomla default media files and folders. (1.39s)
✔ MediaListCest: Test that it shows the  media files and folders of a subdirectory when opened using deep link. (1.44s)
✔ MediaListCest: Test that it is possible to select a single file (1.29s)
✔ MediaListCest: Test that it is possible to select a single folder (1.03s)
✔ MediaListCest: Test that it is possible to select multiple (1.27s)
✔ MediaListCest: Test that it is possible to navigate to a subfolder using double click. (2.50s)
✔ MediaListCest: Test that it is possible to navigate to a subfolder using tree. (2.45s)
✔ MediaListCest: Test that it is possible to navigate to a subfolder using breadcrumb. (2.24s)
✔ MediaListCest: Test the upload of a single file using toolbar button. (8.45s)
S MediaListCest: Test that it shows a confirmation dialog when uploading existing file. 
✔ MediaListCest: Test that it is possible to create a new folder using the toolbar button. (4.00s)
S MediaListCest: Test that it is not possible to create an existing folder. 
✔ MediaListCest: Test that it is possible to delete a single file. (6.33s)
✔ MediaListCest: Test that it is possible to delete a single folder. (3.58s)
✔ MediaListCest: Test that it is possible to delete multiple files. (32.63s)
✔ MediaListCest: Test that it is possible to rename a file. (4.74s)
S MediaListCest: Test that it is not possible to rename a file to a filename of an existing file. 
✔ MediaListCest: Test that it is possible to rename a folder. (4.37s)
S MediaListCest: Test that it is not possible to rename a folder to a foldername of an existing folder. 
✔ MediaListCest: Test that it shows a preview for image when user doubleclicks it. (1.53s)
✔ MediaListCest: Test that it is possible to show a preview of an image using button in action menu. (2.01s)
✔ MediaListCest: Test that it is possible to close the preview modal using the close button. (2.24s)
✔ MediaListCest: Test that it is possible to close the preview modal using escape key. (2.22s)
✔ MediaListCest: Test that it is possible to open the image editor using action menu. (1.83s)
✔ MediaListCest: Test that it is possible to toggle the infobar. (0.98s)
✔ MediaListCest: Test that it shows basic file information in the infobar. (1.61s)
✔ MediaListCest: Test that it shows basic folder information in the infobar. (1.63s)
✔ MediaListCest: Test that it is possible to resize the thumbnails. (1.85s)
✔ MediaListCest: Test that it is possible to toggle the list view (grid/table) using the toolbar button. (1.44s)
✔ MediaListCest: Test that it is possible to select all items using toolbar button. (1.41s)
✔ MediaListCest: Test that the application state is synchronized with session storage. (2.46s)
✔ MenuCest: Create new menu (4.74s)
✔ UserListCest: Create user (7.23s)
✔ UserListCest: Edit user (5.73s)
--------------------------------------------------------------------------------------------------------------------------------


Time: 3.11 minutes, Memory: 16.00 MB

OK, but incomplete, skipped, or risky tests!
Tests: 39, Assertions: 213, Skipped: 4.

I can not run the same for api

/var/www/html/joomla-cms4$ libraries/vendor/bin/codecept run acceptance tests/Codeception/api/
Codeception PHP Testing Framework v4.1.6
Powered by PHPUnit 8.5.8 by Sebastian Bergmann and contributors.
Running with seed: 


Acceptance Tests (9) -----------------------------------------------------------------------------------------------------------
- BasicCest: Test wrong credentialsPHP Fatal error:  Trait '_generated\ApiTesterActions' not found in /var/www/html/joomla-cms4/tests/Codeception/_support/ApiTester.php on line 31
PHP Stack trace:
PHP   1. {main}() /var/www/html/joomla-cms4/libraries/vendor/codeception/codeception/codecept:0
PHP   2. require() /var/www/html/joomla-cms4/libraries/vendor/codeception/codeception/codecept:7
PHP   3. {closure:/var/www/html/joomla-cms4/libraries/vendor/codeception/codeception/app.php:7-47}() /var/www/html/joomla-cms4/libraries/vendor/codeception/codeception/app.php:47
PHP   4. Codeception\Application->run() /var/www/html/joomla-cms4/libraries/vendor/codeception/codeception/app.php:46
PHP   5. Codeception\Application->run() /var/www/html/joomla-cms4/libraries/vendor/codeception/codeception/src/Codeception/Application.php:117
PHP   6. Codeception\Application->doRun() /var/www/html/joomla-cms4/libraries/vendor/symfony/console/Application.php:140
PHP   7. Codeception\Application->doRunCommand() /var/www/html/joomla-cms4/libraries/vendor/symfony/console/Application.php:264
PHP   8. Codeception\Command\Run->run() /var/www/html/joomla-cms4/libraries/vendor/symfony/console/Application.php:911
PHP   9. Codeception\Command\Run->execute() /var/www/html/joomla-cms4/libraries/vendor/symfony/console/Command/Command.php:258
PHP  10. Codeception\Codecept->run() /var/www/html/joomla-cms4/libraries/vendor/codeception/codeception/src/Codeception/Command/Run.php:391
PHP  11. Codeception\Codecept->runSuite() /var/www/html/joomla-cms4/libraries/vendor/codeception/codeception/src/Codeception/Codecept.php:163
PHP  12. Codeception\SuiteManager->run() /var/www/html/joomla-cms4/libraries/vendor/codeception/codeception/src/Codeception/Codecept.php:196
PHP  13. Codeception\PHPUnit\Runner->doEnhancedRun() /var/www/html/joomla-cms4/libraries/vendor/codeception/codeception/src/Codeception/SuiteManager.php:161
PHP  14. Codeception\Suite->run() /var/www/html/joomla-cms4/libraries/vendor/codeception/phpunit-wrapper/src/Runner.php:117
PHP  15. Codeception\Test\Cest->run() /var/www/html/joomla-cms4/libraries/vendor/phpunit/phpunit/src/Framework/TestSuite.php:597
PHP  16. Codeception\Test\Cest->test() /var/www/html/joomla-cms4/libraries/vendor/codeception/codeception/src/Codeception/Test/Test.php:98
PHP  17. Codeception\Test\Cest->executeHook() /var/www/html/joomla-cms4/libraries/vendor/codeception/codeception/src/Codeception/Test/Cest.php:80
PHP  18. Codeception\Test\Cest->invoke() /var/www/html/joomla-cms4/libraries/vendor/codeception/codeception/src/Codeception/Test/Cest.php:97
PHP  19. Codeception\Lib\Di->injectDependencies() /var/www/html/joomla-cms4/libraries/vendor/codeception/codeception/src/Codeception/Test/Cest.php:138
PHP  20. Codeception\Lib\Di->prepareArgs() /var/www/html/joomla-cms4/libraries/vendor/codeception/codeception/src/Codeception/Lib/Di.php:113
PHP  21. ReflectionParameter->getClass() /var/www/html/joomla-cms4/libraries/vendor/codeception/codeception/src/Codeception/Lib/Di.php:141
PHP  22. spl_autoload_call() /var/www/html/joomla-cms4/libraries/vendor/codeception/codeception/src/Codeception/Lib/Di.php:141
PHP  23. Codeception\Util\Autoload::load() /var/www/html/joomla-cms4/libraries/vendor/codeception/codeception/src/Codeception/Lib/Di.php:141
PHP  24. Codeception\Util\Autoload::load() /var/www/html/joomla-cms4/libraries/vendor/codeception/codeception/src/Codeception/Util/Autoload.php:97
PHP  25. Codeception\Util\Autoload::loadMappedFile() /var/www/html/joomla-cms4/libraries/vendor/codeception/codeception/src/Codeception/Util/Autoload.php:86
PHP  26. Codeception\Util\Autoload::requireFile() /var/www/html/joomla-cms4/libraries/vendor/codeception/codeception/src/Codeception/Util/Autoload.php:132
PHP  27. require_once() /var/www/html/joomla-cms4/libraries/vendor/codeception/codeception/src/Codeception/Util/Autoload.php:143



FATAL ERROR. TESTS NOT FINISHED.
Trait '_generated\ApiTesterActions' not found 
in /var/www/html/joomla-cms4/tests/Codeception/_support/ApiTester.php:31

In the readme https://github.com/joomla/joomla-cms/tree/4.0-dev/tests/Codeception#api-testing-for-joomla I read that I have to run vendor/bin/codecept run api. But that's wrong, right? I can not find the folder vendor/bin/codecept.

Then I found in the file https://github.com/joomla/joomla-cms/blob/d8930208814fb52c0871853cfd9298f70998fd1f/.drone.yml#L189 that api test are run via tests/Codeception/drone-api-run.sh. So i tried the following where Test crud on banner failed. But that's probably only due to the password, which is different in my installation.



/var/www/html/joomla-cms4$ php libraries/vendor/bin/codecept run api --fail-fast --steps --debug
Codeception PHP Testing Framework v4.1.6
Powered by PHPUnit 8.5.8 by Sebastian Bergmann and contributors.
Running with seed: 


  [Connecting To Db] {"config":{"populate":false,"cleanup":false,"reconnect":false,"waitlock":0,"dump":null,"populator":null,"dsn":"mysql:host=localhost;dbname=joomla_db","user":"root","password":"mypassword","prefix":"c4in8_"},"options":[]}
  [Db] Connected to default joomla_db

Api Tests (9) --------------------------------------------------------------------------------------------------------------------------------
Modules: \Helper\JoomlaDb, \Helper\Api, REST, PhpBrowser
----------------------------------------------------------------------------------------------------------------------------------------------
BasicCest: Test wrong credentials
Signature: BasicCest:testWrongCredentials
Test: tests/Codeception/api/BasicCest.php:testWrongCredentials
Scenario --
 I update in database "users",{"id":3},[]
  [Query] UPDATE `c4in8_users` SET `id` = ? 
  [Parameters] [3]
 I update in database "user_usergroup_map",{"user_id":3},[]
  [Query] UPDATE `c4in8_user_usergroup_map` SET `user_id` = ? 
  [Parameters] [3]
 I have in database "user_profiles",{"user_id":3,"profile_key":"joomlatoken.enabled","profile_value":1}
  [Query] INSERT INTO `c4in8_user_profiles` (`user_id`, `profile_key`, `profile_value`) VALUES (?, ?, ?)
  [Parameters] [3,"joomlatoken.enabled",1]
 I have in database "user_profiles",{"user_id":3,"profile_key":"joomlatoken.token","profile_value":"dOi2m1NRrnBHlhaWK/WWxh3B5tqq1INbdf4DhU...}
  [Query] INSERT INTO `c4in8_user_profiles` (`user_id`, `profile_key`, `profile_value`) VALUES (?, ?, ?)
  [Parameters] [3,"joomlatoken.token","dOi2m1NRrnBHlhaWK/WWxh3B5tqq1INbdf4DhUmYTI4="]
 I am bearer authenticated "BADTOKEN"
 I have http header "Accept","application/vnd.api+json"
 I send get "/content/article/1"
  [Request] GET http://localhost/joomla-cms4/api/index.php/v1/content/article/1
  [Request Headers] {"Authorization":"Bearer BADTOKEN","Accept":"application/vnd.api+json"}
  [Page] http://localhost/joomla-cms4/api/index.php/v1/content/article/1
  [Response] 401
  [Request Cookies] []
  [Response Headers] {"Date":["Fri, 28 Aug 2020 20:30:08 GMT"],"Server":["Apache/2.4.29 (Ubuntu)"],"x-frame-options":["SAMEORIGIN"],"referrer-policy":["strict-origin-when-cross-origin"],"cross-origin-opener-policy":["same-origin"],"X-Powered-By":["JoomlaAPI/1.0"],"Expires":["Wed, 17 Aug 2005 00:00:00 GMT"],"Last-Modified":["Fri, 28 Aug 2020 20:30:08 GMT"],"Cache-Control":["no-store, no-cache, must-revalidate, post-check=0, pre-check=0"],"Pragma":["no-cache"],"Content-Length":["34"],"Content-Type":["application/vnd.api+json; charset=utf-8"]}
  [Response] {"errors":[{"title":"Forbidden"}]}
 I see response code is 401
 PASSED 

BasicCest: Test content negotation
Signature: BasicCest:testContentNegotation
Test: tests/Codeception/api/BasicCest.php:testContentNegotation
Scenario --
 I update in database "users",{"id":3},[]
  [Query] UPDATE `c4in8_users` SET `id` = ? 
  [Parameters] [3]
 I update in database "user_usergroup_map",{"user_id":3},[]
  [Query] UPDATE `c4in8_user_usergroup_map` SET `user_id` = ? 
  [Parameters] [3]
 I have in database "user_profiles",{"user_id":3,"profile_key":"joomlatoken.enabled","profile_value":1}
  [Query] INSERT INTO `c4in8_user_profiles` (`user_id`, `profile_key`, `profile_value`) VALUES (?, ?, ?)
  [Parameters] [3,"joomlatoken.enabled",1]
 I have in database "user_profiles",{"user_id":3,"profile_key":"joomlatoken.token","profile_value":"dOi2m1NRrnBHlhaWK/WWxh3B5tqq1INbdf4DhU...}
  [Query] INSERT INTO `c4in8_user_profiles` (`user_id`, `profile_key`, `profile_value`) VALUES (?, ?, ?)
  [Parameters] [3,"joomlatoken.token","dOi2m1NRrnBHlhaWK/WWxh3B5tqq1INbdf4DhUmYTI4="]
 I am bearer authenticated "c2hhMjU2OjM6ZTJmMjJlYTNlNTU0NmM1MDJhYTIzYzMwN2MxYzAwZTQ5NzJhMWRmOTUyNjY5MTk2YjE5ODJmZWMwZTcxNzgwMQ=="
 I have http header "Accept","text/xml"
 I send get "/content/article/1"
  [Request] GET http://localhost/joomla-cms4/api/index.php/v1/content/article/1
  [Request Headers] {"Authorization":"Bearer c2hhMjU2OjM6ZTJmMjJlYTNlNTU0NmM1MDJhYTIzYzMwN2MxYzAwZTQ5NzJhMWRmOTUyNjY5MTk2YjE5ODJmZWMwZTcxNzgwMQ==","Accept":"text/xml"}
  [Page] http://localhost/joomla-cms4/api/index.php/v1/content/article/1
  [Response] 406
  [Request Cookies] []
  [Response Headers] {"Date":["Fri, 28 Aug 2020 20:30:08 GMT"],"Server":["Apache/2.4.29 (Ubuntu)"],"x-frame-options":["SAMEORIGIN"],"referrer-policy":["strict-origin-when-cross-origin"],"cross-origin-opener-policy":["same-origin"],"X-Powered-By":["JoomlaAPI/1.0"],"Expires":["Wed, 17 Aug 2005 00:00:00 GMT"],"Last-Modified":["Fri, 28 Aug 2020 20:30:08 GMT"],"Cache-Control":["no-store, no-cache, must-revalidate, post-check=0, pre-check=0"],"Pragma":["no-cache"],"Content-Length":["29"],"Content-Type":["text/html; charset=utf-8"]}
  [Response] Could not match accept header
 I see response code is 406
 PASSED 

BasicCest: Test route not found
Signature: BasicCest:testRouteNotFound
Test: tests/Codeception/api/BasicCest.php:testRouteNotFound
Scenario --
 I update in database "users",{"id":3},[]
  [Query] UPDATE `c4in8_users` SET `id` = ? 
  [Parameters] [3]
 I update in database "user_usergroup_map",{"user_id":3},[]
  [Query] UPDATE `c4in8_user_usergroup_map` SET `user_id` = ? 
  [Parameters] [3]
 I have in database "user_profiles",{"user_id":3,"profile_key":"joomlatoken.enabled","profile_value":1}
  [Query] INSERT INTO `c4in8_user_profiles` (`user_id`, `profile_key`, `profile_value`) VALUES (?, ?, ?)
  [Parameters] [3,"joomlatoken.enabled",1]
 I have in database "user_profiles",{"user_id":3,"profile_key":"joomlatoken.token","profile_value":"dOi2m1NRrnBHlhaWK/WWxh3B5tqq1INbdf4DhU...}
  [Query] INSERT INTO `c4in8_user_profiles` (`user_id`, `profile_key`, `profile_value`) VALUES (?, ?, ?)
  [Parameters] [3,"joomlatoken.token","dOi2m1NRrnBHlhaWK/WWxh3B5tqq1INbdf4DhUmYTI4="]
 I am bearer authenticated "c2hhMjU2OjM6ZTJmMjJlYTNlNTU0NmM1MDJhYTIzYzMwN2MxYzAwZTQ5NzJhMWRmOTUyNjY5MTk2YjE5ODJmZWMwZTcxNzgwMQ=="
 I have http header "Accept","application/vnd.api+json"
 I send get "/not/existing/1"
  [Request] GET http://localhost/joomla-cms4/api/index.php/v1/not/existing/1
  [Request Headers] {"Authorization":"Bearer c2hhMjU2OjM6ZTJmMjJlYTNlNTU0NmM1MDJhYTIzYzMwN2MxYzAwZTQ5NzJhMWRmOTUyNjY5MTk2YjE5ODJmZWMwZTcxNzgwMQ==","Accept":"application/vnd.api+json"}
  [Page] http://localhost/joomla-cms4/api/index.php/v1/not/existing/1
  [Response] 404
  [Request Cookies] []
  [Response Headers] {"Date":["Fri, 28 Aug 2020 20:30:08 GMT"],"Server":["Apache/2.4.29 (Ubuntu)"],"x-frame-options":["SAMEORIGIN"],"referrer-policy":["strict-origin-when-cross-origin"],"cross-origin-opener-policy":["same-origin"],"X-Powered-By":["JoomlaAPI/1.0"],"Expires":["Wed, 17 Aug 2005 00:00:00 GMT"],"Last-Modified":["Fri, 28 Aug 2020 20:30:08 GMT"],"Cache-Control":["no-store, no-cache, must-revalidate, post-check=0, pre-check=0"],"Pragma":["no-cache"],"Content-Length":["54"],"Content-Type":["application/vnd.api+json; charset=utf-8"]}
  [Response] {"errors":[{"title":"Resource not found","code":404}]}
 I see response code is 404
 PASSED 

BannerCest: Test crud on banner
Signature: BannerCest:testCrudOnBanner
Test: tests/Codeception/api/com_banners/BannerCest.php:testCrudOnBanner
Scenario --
 I update in database "users",{"id":3},[]
  [Query] UPDATE `c4in8_users` SET `id` = ? 
  [Parameters] [3]
 I update in database "user_usergroup_map",{"user_id":3},[]
  [Query] UPDATE `c4in8_user_usergroup_map` SET `user_id` = ? 
  [Parameters] [3]
 I have in database "user_profiles",{"user_id":3,"profile_key":"joomlatoken.enabled","profile_value":1}
  [Query] INSERT INTO `c4in8_user_profiles` (`user_id`, `profile_key`, `profile_value`) VALUES (?, ?, ?)
  [Parameters] [3,"joomlatoken.enabled",1]
 I have in database "user_profiles",{"user_id":3,"profile_key":"joomlatoken.token","profile_value":"dOi2m1NRrnBHlhaWK/WWxh3B5tqq1INbdf4DhU...}
  [Query] INSERT INTO `c4in8_user_profiles` (`user_id`, `profile_key`, `profile_value`) VALUES (?, ?, ?)
  [Parameters] [3,"joomlatoken.token","dOi2m1NRrnBHlhaWK/WWxh3B5tqq1INbdf4DhUmYTI4="]
 I am bearer authenticated "c2hhMjU2OjM6ZTJmMjJlYTNlNTU0NmM1MDJhYTIzYzMwN2MxYzAwZTQ5NzJhMWRmOTUyNjY5MTk2YjE5ODJmZWMwZTcxNzgwMQ=="
 I have http header "Content-Type","application/json"
 I have http header "Accept","application/vnd.api+json"
 I send post "/banners",{"name":"My Custom Advert","catid":3,"description":"","custombannercode":"","metakey":"","params":{"imageurl":"","...}
  [Request] POST http://localhost/joomla-cms4/api/index.php/v1/banners {"name":"My Custom Advert","catid":3,"description":"","custombannercode":"","metakey":"","params":{"imageurl":"","width":"","height":"","alt":""}}
  [Request Headers] {"Authorization":"Bearer c2hhMjU2OjM6ZTJmMjJlYTNlNTU0NmM1MDJhYTIzYzMwN2MxYzAwZTQ5NzJhMWRmOTUyNjY5MTk2YjE5ODJmZWMwZTcxNzgwMQ==","Content-Type":"application/json","Accept":"application/vnd.api+json"}
  [Page] http://localhost/joomla-cms4/api/index.php/v1/banners
  [Response] 401
  [Request Cookies] []
  [Response Headers] {"Date":["Fri, 28 Aug 2020 20:30:08 GMT"],"Server":["Apache/2.4.29 (Ubuntu)"],"x-frame-options":["SAMEORIGIN"],"referrer-policy":["strict-origin-when-cross-origin"],"cross-origin-opener-policy":["same-origin"],"X-Powered-By":["JoomlaAPI/1.0"],"Expires":["Wed, 17 Aug 2005 00:00:00 GMT"],"Last-Modified":["Fri, 28 Aug 2020 20:30:08 GMT"],"Cache-Control":["no-store, no-cache, must-revalidate, post-check=0, pre-check=0"],"Pragma":["no-cache"],"Content-Length":["34"],"Content-Type":["application/vnd.api+json; charset=utf-8"]}
  [Response] {"errors":[{"title":"Forbidden"}]}
 I see response code is 200
 FAIL 

----------------------------------------------------------------------------------------------------------------------------------------------


Time: 679 ms, Memory: 14.00 MB

There was 1 failure:

---------
1) BannerCest: Test crud on banner
 Test  tests/Codeception/api/com_banners/BannerCest.php:testCrudOnBanner
 Step  See response code is 200
 Fail  Expected HTTP Status Code: 200 (OK). Actual Status Code: 401 (Unauthorized)
Failed asserting that 401 matches expected 200.

Scenario Steps:

 9. $I->seeResponseCodeIs(200) at tests/Codeception/api/com_banners/BannerCest.php:88
 8. $I->sendPOST("/banners",{"name":"My Custom Advert","catid":3,"description":"","custombannercode":"","metakey":"","params":{"imageurl"...}) at tests/Codeception/api/com_banners/BannerCest.php:86
 7. $I->haveHttpHeader("Accept","application/vnd.api+json") at tests/Codeception/api/com_banners/BannerCest.php:70
 6. $I->haveHttpHeader("Content-Type","application/json") at tests/Codeception/api/com_banners/BannerCest.php:69
 5. $I->amBearerAuthenticated("c2hhMjU2OjM6ZTJmMjJlYTNlNTU0NmM1MDJhYTIzYzMwN2MxYzAwZTQ5NzJhMWRmOTUyNjY5MTk2YjE5ODJmZWMwZTcxNzgwMQ==") at tests/Codeception/api/com_banners/BannerCest.php:68
 4. $I->haveInDatabase("user_profiles",{"user_id":3,"profile_key":"joomlatoken.token","profile_value":"dOi2m1NRrnBHlhaWK/WWxh3B5tqq1INbdf...}) at tests/Codeception/api/com_banners/BannerCest.php:39

Artifacts:

Body: {"errors":[{"title":"Forbidden"}]}
Html: /var/www/html/joomla-cms4/tests/Codeception/_output/BannerCest.testCrudOnBanner.fail.html
Response: /var/www/html/joomla-cms4/tests/Codeception/_output/BannerCest.testCrudOnBanner.fail.html

FAILURES!
Tests: 4, Assertions: 4, Failures: 1.
  [Db] Disconnected from default

@wilsonge
Copy link
Contributor Author

@astridx I’d imagine it’s related to the site secret (

# If you have found this line failing on OSX you need to brew install gnu-sed like we mentioned in the codeception readme!
) - we rely on a fixed site secret so we have a consistent user token (if you look at the codeception tasks run in that bash file you probably can piece together what’s missing from the readme)

@alikon
Copy link
Contributor

alikon commented Aug 29, 2020

i was able to create a category for com_banners without this pr
Screenshot from 2020-08-29 09-29-21

@astridx
Copy link
Contributor

astridx commented Aug 29, 2020

i was able to create a category for com_banners without this pr

I understood it to be possible to create a category without the workflow_id parameter, since workflow doesn't exist in com_banners?

@wilsonge
Copy link
Contributor Author

@alikon exactly what @astridx says - the form required a workflow (because the com_content JForm instance is loaded rather than com_banners). Remove the params -> workflow id param from your query there and try again

@alikon
Copy link
Contributor

alikon commented Aug 31, 2020

ok, but then the documentation should be fixed https://docs.joomla.org/J4.x:Joomla_Core_APIs#Create_Category

i wasn't able to run the test coverage suite , but i'll mark this pr as Tested successfully cause Drone is happy

@alikon
Copy link
Contributor

alikon commented Aug 31, 2020

I have tested this item ✅ successfully on 4e4a360


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/26722.

@wilsonge
Copy link
Contributor Author

Documentation fixed

@astridx
Copy link
Contributor

astridx commented Sep 1, 2020

@astridx I’d imagine it’s related to the site secret (

# If you have found this line failing on OSX you need to brew install gnu-sed like we mentioned in the codeception readme!

) - we rely on a fixed site secret so we have a consistent user token (if you look at the codeception tasks run in that bash file you probably can piece together what’s missing from the readme)

I changed the secret in my Configuration.php and now all 9 tests went through.

libraries/vendor/bin/codecept run api --fail-fast --steps --debug
q 
Codeception PHP Testing Framework v4.1.6
Powered by PHPUnit 8.5.8 by Sebastian Bergmann and contributors.
Running with seed: 


  [Connecting To Db] {"config":{"populate":false,"cleanup":false,"reconnect":false,"waitlock":0,"dump":null,"populator":null,"dsn":"mysql:host=localhost;dbname=joomla_db","user":"root","password":"Schweden1!","prefix":"c4in8_"},"options":[]}
  [Db] Connected to default joomla_db

Api Tests (9) ------------------------------------------------------------------
Modules: \Helper\JoomlaDb, \Helper\Api, REST, PhpBrowser
--------------------------------------------------------------------------------
BasicCest: Test wrong credentials
Signature: BasicCest:testWrongCredentials
Test: tests/Codeception/api/BasicCest.php:testWrongCredentials
Scenario --
 I update in database "users",{"id":3},[]
  [Query] UPDATE `c4in8_users` SET `id` = ? 
  [Parameters] [3]
 I update in database "user_usergroup_map",{"user_id":3},[]
  [Query] UPDATE `c4in8_user_usergroup_map` SET `user_id` = ? 
  [Parameters] [3]
 I have in database "user_profiles",{"user_id":3,"profile_key":"joomlatoken....}
  [Query] INSERT INTO `c4in8_user_profiles` (`user_id`, `profile_key`, `profile_value`) VALUES (?, ?, ?)
  [Parameters] [3,"joomlatoken.enabled",1]
 I have in database "user_profiles",{"user_id":3,"profile_key":"joomlatoken....}
  [Query] INSERT INTO `c4in8_user_profiles` (`user_id`, `profile_key`, `profile_value`) VALUES (?, ?, ?)
  [Parameters] [3,"joomlatoken.token","dOi2m1NRrnBHlhaWK/WWxh3B5tqq1INbdf4DhUmYTI4="]
 I am bearer authenticated "BADTOKEN"
 I have http header "Accept","application/vnd.api+json"
 I send get "/content/article/1"
  [Request] GET http://localhost/joomla-cms4/api/index.php/v1/content/article/1
  [Request Headers] {"Authorization":"Bearer BADTOKEN","Accept":"application/vnd.api+json"}
  [Page] http://localhost/joomla-cms4/api/index.php/v1/content/article/1
  [Response] 401
  [Request Cookies] []
  [Response Headers] {"Date":["Tue, 01 Sep 2020 09:51:31 GMT"],"Server":["Apache/2.4.29 (Ubuntu)"],"x-frame-options":["SAMEORIGIN"],"referrer-policy":["strict-origin-when-cross-origin"],"cross-origin-opener-policy":["same-origin"],"X-Powered-By":["JoomlaAPI/1.0"],"Expires":["Wed, 17 Aug 2005 00:00:00 GMT"],"Last-Modified":["Tue, 01 Sep 2020 09:51:32 GMT"],"Cache-Control":["no-store, no-cache, must-revalidate, post-check=0, pre-check=0"],"Pragma":["no-cache"],"Content-Length":["34"],"Content-Type":["application/vnd.api+json; charset=utf-8"]}
  [Response] {"errors":[{"title":"Forbidden"}]}
 I see response code is 401
 PASSED 

BasicCest: Test content negotation
Signature: BasicCest:testContentNegotation
Test: tests/Codeception/api/BasicCest.php:testContentNegotation
Scenario --
 I update in database "users",{"id":3},[]
  [Query] UPDATE `c4in8_users` SET `id` = ? 
  [Parameters] [3]
 I update in database "user_usergroup_map",{"user_id":3},[]
  [Query] UPDATE `c4in8_user_usergroup_map` SET `user_id` = ? 
  [Parameters] [3]
 I have in database "user_profiles",{"user_id":3,"profile_key":"joomlatoken....}
  [Query] INSERT INTO `c4in8_user_profiles` (`user_id`, `profile_key`, `profile_value`) VALUES (?, ?, ?)
  [Parameters] [3,"joomlatoken.enabled",1]
 I have in database "user_profiles",{"user_id":3,"profile_key":"joomlatoken....}
  [Query] INSERT INTO `c4in8_user_profiles` (`user_id`, `profile_key`, `profile_value`) VALUES (?, ?, ?)
  [Parameters] [3,"joomlatoken.token","dOi2m1NRrnBHlhaWK/WWxh3B5tqq1INbdf4DhUmYTI4="]
 I am bearer authenticated "c2hhMjU2OjM6ZTJmMjJlYTNlNTU0NmM1MDJhYTIzYzMwN2Mx..."
 I have http header "Accept","text/xml"
 I send get "/content/article/1"
  [Request] GET http://localhost/joomla-cms4/api/index.php/v1/content/article/1
  [Request Headers] {"Authorization":"Bearer c2hhMjU2OjM6ZTJmMjJlYTNlNTU0NmM1MDJhYTIzYzMwN2MxYzAwZTQ5NzJhMWRmOTUyNjY5MTk2YjE5ODJmZWMwZTcxNzgwMQ==","Accept":"text/xml"}
  [Page] http://localhost/joomla-cms4/api/index.php/v1/content/article/1
  [Response] 406
  [Request Cookies] []
  [Response Headers] {"Date":["Tue, 01 Sep 2020 09:51:32 GMT"],"Server":["Apache/2.4.29 (Ubuntu)"],"x-frame-options":["SAMEORIGIN"],"referrer-policy":["strict-origin-when-cross-origin"],"cross-origin-opener-policy":["same-origin"],"X-Powered-By":["JoomlaAPI/1.0"],"Expires":["Wed, 17 Aug 2005 00:00:00 GMT"],"Last-Modified":["Tue, 01 Sep 2020 09:51:32 GMT"],"Cache-Control":["no-store, no-cache, must-revalidate, post-check=0, pre-check=0"],"Pragma":["no-cache"],"Content-Length":["29"],"Content-Type":["text/html; charset=utf-8"]}
  [Response] Could not match accept header
 I see response code is 406
 PASSED 

BasicCest: Test route not found
Signature: BasicCest:testRouteNotFound
Test: tests/Codeception/api/BasicCest.php:testRouteNotFound
Scenario --
 I update in database "users",{"id":3},[]
  [Query] UPDATE `c4in8_users` SET `id` = ? 
  [Parameters] [3]
 I update in database "user_usergroup_map",{"user_id":3},[]
  [Query] UPDATE `c4in8_user_usergroup_map` SET `user_id` = ? 
  [Parameters] [3]
 I have in database "user_profiles",{"user_id":3,"profile_key":"joomlatoken....}
  [Query] INSERT INTO `c4in8_user_profiles` (`user_id`, `profile_key`, `profile_value`) VALUES (?, ?, ?)
  [Parameters] [3,"joomlatoken.enabled",1]
 I have in database "user_profiles",{"user_id":3,"profile_key":"joomlatoken....}
  [Query] INSERT INTO `c4in8_user_profiles` (`user_id`, `profile_key`, `profile_value`) VALUES (?, ?, ?)
  [Parameters] [3,"joomlatoken.token","dOi2m1NRrnBHlhaWK/WWxh3B5tqq1INbdf4DhUmYTI4="]
 I am bearer authenticated "c2hhMjU2OjM6ZTJmMjJlYTNlNTU0NmM1MDJhYTIzYzMwN2Mx..."
 I have http header "Accept","application/vnd.api+json"
 I send get "/not/existing/1"
  [Request] GET http://localhost/joomla-cms4/api/index.php/v1/not/existing/1
  [Request Headers] {"Authorization":"Bearer c2hhMjU2OjM6ZTJmMjJlYTNlNTU0NmM1MDJhYTIzYzMwN2MxYzAwZTQ5NzJhMWRmOTUyNjY5MTk2YjE5ODJmZWMwZTcxNzgwMQ==","Accept":"application/vnd.api+json"}
  [Page] http://localhost/joomla-cms4/api/index.php/v1/not/existing/1
  [Response] 404
  [Request Cookies] []
  [Response Headers] {"Date":["Tue, 01 Sep 2020 09:51:32 GMT"],"Server":["Apache/2.4.29 (Ubuntu)"],"x-frame-options":["SAMEORIGIN"],"referrer-policy":["strict-origin-when-cross-origin"],"cross-origin-opener-policy":["same-origin"],"X-Powered-By":["JoomlaAPI/1.0"],"Expires":["Wed, 17 Aug 2005 00:00:00 GMT"],"Last-Modified":["Tue, 01 Sep 2020 09:51:32 GMT"],"Cache-Control":["no-store, no-cache, must-revalidate, post-check=0, pre-check=0"],"Pragma":["no-cache"],"Content-Length":["54"],"Content-Type":["application/vnd.api+json; charset=utf-8"]}
  [Response] {"errors":[{"title":"Resource not found","code":404}]}
 I see response code is 404
 PASSED 

BannerCest: Test crud on banner
Signature: BannerCest:testCrudOnBanner
Test: tests/Codeception/api/com_banners/BannerCest.php:testCrudOnBanner
Scenario --
 I update in database "users",{"id":3},[]
  [Query] UPDATE `c4in8_users` SET `id` = ? 
  [Parameters] [3]
 I update in database "user_usergroup_map",{"user_id":3},[]
  [Query] UPDATE `c4in8_user_usergroup_map` SET `user_id` = ? 
  [Parameters] [3]
 I have in database "user_profiles",{"user_id":3,"profile_key":"joomlatoken....}
  [Query] INSERT INTO `c4in8_user_profiles` (`user_id`, `profile_key`, `profile_value`) VALUES (?, ?, ?)
  [Parameters] [3,"joomlatoken.enabled",1]
 I have in database "user_profiles",{"user_id":3,"profile_key":"joomlatoken....}
  [Query] INSERT INTO `c4in8_user_profiles` (`user_id`, `profile_key`, `profile_value`) VALUES (?, ?, ?)
  [Parameters] [3,"joomlatoken.token","dOi2m1NRrnBHlhaWK/WWxh3B5tqq1INbdf4DhUmYTI4="]
 I am bearer authenticated "c2hhMjU2OjM6ZTJmMjJlYTNlNTU0NmM1MDJhYTIzYzMwN2Mx..."
 I have http header "Content-Type","application/json"
 I have http header "Accept","application/vnd.api+json"
 I send post "/banners",{"name":"My Custom Advert","catid":3,"description":"...}
  [Request] POST http://localhost/joomla-cms4/api/index.php/v1/banners {"name":"My Custom Advert","catid":3,"description":"","custombannercode":"","metakey":"","params":{"imageurl":"","width":"","height":"","alt":""}}
  [Request Headers] {"Authorization":"Bearer c2hhMjU2OjM6ZTJmMjJlYTNlNTU0NmM1MDJhYTIzYzMwN2MxYzAwZTQ5NzJhMWRmOTUyNjY5MTk2YjE5ODJmZWMwZTcxNzgwMQ==","Content-Type":"application/json","Accept":"application/vnd.api+json"}
  [Page] http://localhost/joomla-cms4/api/index.php/v1/banners
  [Response] 200
  [Request Cookies] []
  [Response Headers] {"Date":["Tue, 01 Sep 2020 09:51:32 GMT"],"Server":["Apache/2.4.29 (Ubuntu)"],"x-frame-options":["SAMEORIGIN"],"referrer-policy":["strict-origin-when-cross-origin"],"cross-origin-opener-policy":["same-origin"],"X-Powered-By":["JoomlaAPI/1.0"],"Expires":["Wed, 17 Aug 2005 00:00:00 GMT"],"Last-Modified":["Tue, 01 Sep 2020 09:51:33 GMT"],"Cache-Control":["no-store, no-cache, must-revalidate, post-check=0, pre-check=0"],"Pragma":["no-cache"],"Content-Length":["777"],"Content-Type":["application/vnd.api+json; charset=utf-8"]}
  [Response] {"links":{"self":"http://localhost/joomla-cms4/api/index.php/v1/banners"},"data":{"type":"banners","id":"1","attributes":{"typeAlias":"com_banners.banner","id":1,"cid":0,"type":0,"name":"My Custom Advert","alias":"my-custom-advert","imptotal":0,"impmade":0,"clicks":0,"clickurl":"","state":0,"catid":3,"description":"","custombannercode":"","sticky":0,"ordering":1,"metakey":"","params":{"imageurl":"","width":"","height":"","alt":""},"own_prefix":0,"metakey_prefix":"","purchase_type":-1,"track_clicks":-1,"track_impressions":-1,"checked_out":null,"checked_out_time":null,"publish_up":null,"publish_down":null,"reset":null,"created":"2020-09-01 09:51:32","language":"","created_by":3,"created_by_alias":"","modified":"2020-09-01 09:51:32","modified_by":3,"version":1}}}
 I see response code is 200
 I am bearer authenticated "c2hhMjU2OjM6ZTJmMjJlYTNlNTU0NmM1MDJhYTIzYzMwN2Mx..."
 I have http header "Accept","application/vnd.api+json"
 I send get "/banners/1"
  [Request] GET http://localhost/joomla-cms4/api/index.php/v1/banners/1
  [Request Headers] {"Authorization":"Bearer c2hhMjU2OjM6ZTJmMjJlYTNlNTU0NmM1MDJhYTIzYzMwN2MxYzAwZTQ5NzJhMWRmOTUyNjY5MTk2YjE5ODJmZWMwZTcxNzgwMQ==","Content-Type":"application/json","Accept":"application/vnd.api+json"}
  [Page] http://localhost/joomla-cms4/api/index.php/v1/banners/1
  [Response] 200
  [Request Cookies] []
  [Response Headers] {"Date":["Tue, 01 Sep 2020 09:51:33 GMT"],"Server":["Apache/2.4.29 (Ubuntu)"],"x-frame-options":["SAMEORIGIN"],"referrer-policy":["strict-origin-when-cross-origin"],"cross-origin-opener-policy":["same-origin"],"X-Powered-By":["JoomlaAPI/1.0"],"Expires":["Wed, 17 Aug 2005 00:00:00 GMT"],"Last-Modified":["Tue, 01 Sep 2020 09:51:33 GMT"],"Cache-Control":["no-store, no-cache, must-revalidate, post-check=0, pre-check=0"],"Pragma":["no-cache"],"Content-Length":["780"],"Content-Type":["application/vnd.api+json; charset=utf-8"]}
  [Response] {"links":{"self":"http://localhost/joomla-cms4/api/index.php/v1/banners/1"},"data":{"type":"banners","id":"1","attributes":{"typeAlias":"com_banners.banner","id":1,"cid":0,"type":0,"name":"My Custom Advert","alias":"my-custom-advert","imptotal":0,"impmade":0,"clicks":0,"clickurl":"","state":0,"catid":3,"description":"","custombannercode":"","sticky":0,"ordering":1,"metakey":"","params":{"imageurl":"","width":"","height":"","alt":""},"own_prefix":0,"metakey_prefix":"","purchase_type":-1,"track_clicks":-1,"track_impressions":-1,"checked_out":null,"checked_out_time":null,"publish_up":null,"publish_down":null,"reset":null,"created":"2020-09-01 09:51:32","language":"","created_by":3,"created_by_alias":"","modified":"2020-09-01 09:51:32","modified_by":3,"version":1}}}
 I see response code is 200
 I am bearer authenticated "c2hhMjU2OjM6ZTJmMjJlYTNlNTU0NmM1MDJhYTIzYzMwN2Mx..."
 I have http header "Content-Type","application/json"
 I have http header "Accept","application/vnd.api+json"
 I send patch "/banners/1",{"name":"Different Custom Advert","state":-2,"cat...}
  [Request] PATCH http://localhost/joomla-cms4/api/index.php/v1/banners/1 {"name":"Different Custom Advert","state":-2,"catid":3}
  [Request Headers] {"Authorization":"Bearer c2hhMjU2OjM6ZTJmMjJlYTNlNTU0NmM1MDJhYTIzYzMwN2MxYzAwZTQ5NzJhMWRmOTUyNjY5MTk2YjE5ODJmZWMwZTcxNzgwMQ==","Content-Type":"application/json","Accept":"application/vnd.api+json"}
  [Page] http://localhost/joomla-cms4/api/index.php/v1/banners/1
  [Response] 200
  [Request Cookies] []
  [Response Headers] {"Date":["Tue, 01 Sep 2020 09:51:33 GMT"],"Server":["Apache/2.4.29 (Ubuntu)"],"x-frame-options":["SAMEORIGIN"],"referrer-policy":["strict-origin-when-cross-origin"],"cross-origin-opener-policy":["same-origin"],"X-Powered-By":["JoomlaAPI/1.0"],"Expires":["Wed, 17 Aug 2005 00:00:00 GMT"],"Last-Modified":["Tue, 01 Sep 2020 09:51:33 GMT"],"Cache-Control":["no-store, no-cache, must-revalidate, post-check=0, pre-check=0"],"Pragma":["no-cache"],"Content-Length":["2"],"Content-Type":["application/vnd.api+json; charset=utf-8"]}
  [Response] []
 I see response code is 200
 I am bearer authenticated "c2hhMjU2OjM6ZTJmMjJlYTNlNTU0NmM1MDJhYTIzYzMwN2Mx..."
 I have http header "Accept","application/vnd.api+json"
 I send delete "/banners/1"
  [Request] DELETE http://localhost/joomla-cms4/api/index.php/v1/banners/1 []
  [Request Headers] {"Authorization":"Bearer c2hhMjU2OjM6ZTJmMjJlYTNlNTU0NmM1MDJhYTIzYzMwN2MxYzAwZTQ5NzJhMWRmOTUyNjY5MTk2YjE5ODJmZWMwZTcxNzgwMQ==","Content-Type":"application/json","Accept":"application/vnd.api+json"}
  [Page] http://localhost/joomla-cms4/api/index.php/v1/banners/1
  [Response] 204
  [Request Cookies] []
  [Response Headers] {"Date":["Tue, 01 Sep 2020 09:51:33 GMT"],"Server":["Apache/2.4.29 (Ubuntu)"],"x-frame-options":["SAMEORIGIN"],"referrer-policy":["strict-origin-when-cross-origin"],"cross-origin-opener-policy":["same-origin"],"X-Powered-By":["JoomlaAPI/1.0"],"Expires":["Wed, 17 Aug 2005 00:00:00 GMT"],"Last-Modified":["Tue, 01 Sep 2020 09:51:33 GMT"],"Cache-Control":["no-store, no-cache, must-revalidate, post-check=0, pre-check=0"],"Pragma":["no-cache"],"Content-Type":["text/html"]}
  [Response] 
 I see response code is 204
 PASSED 

BannerCest: Test crud on category
Signature: BannerCest:testCrudOnCategory
Test: tests/Codeception/api/com_banners/BannerCest.php:testCrudOnCategory
Scenario --
 I update in database "users",{"id":3},[]
  [Query] UPDATE `c4in8_users` SET `id` = ? 
  [Parameters] [3]
 I update in database "user_usergroup_map",{"user_id":3},[]
  [Query] UPDATE `c4in8_user_usergroup_map` SET `user_id` = ? 
  [Parameters] [3]
 I have in database "user_profiles",{"user_id":3,"profile_key":"joomlatoken....}
  [Query] INSERT INTO `c4in8_user_profiles` (`user_id`, `profile_key`, `profile_value`) VALUES (?, ?, ?)
  [Parameters] [3,"joomlatoken.enabled",1]
 I have in database "user_profiles",{"user_id":3,"profile_key":"joomlatoken....}
  [Query] INSERT INTO `c4in8_user_profiles` (`user_id`, `profile_key`, `profile_value`) VALUES (?, ?, ?)
  [Parameters] [3,"joomlatoken.token","dOi2m1NRrnBHlhaWK/WWxh3B5tqq1INbdf4DhUmYTI4="]
 I am bearer authenticated "c2hhMjU2OjM6ZTJmMjJlYTNlNTU0NmM1MDJhYTIzYzMwN2Mx..."
 I have http header "Content-Type","application/json"
 I have http header "Accept","application/vnd.api+json"
 I send post "/banners/categories",{"title":"A test category","parent_id":3}
  [Request] POST http://localhost/joomla-cms4/api/index.php/v1/banners/categories {"title":"A test category","parent_id":3}
  [Request Headers] {"Authorization":"Bearer c2hhMjU2OjM6ZTJmMjJlYTNlNTU0NmM1MDJhYTIzYzMwN2MxYzAwZTQ5NzJhMWRmOTUyNjY5MTk2YjE5ODJmZWMwZTcxNzgwMQ==","Content-Type":"application/json","Accept":"application/vnd.api+json"}
  [Page] http://localhost/joomla-cms4/api/index.php/v1/banners/categories
  [Response] 200
  [Request Cookies] []
  [Response Headers] {"Date":["Tue, 01 Sep 2020 09:51:33 GMT"],"Server":["Apache/2.4.29 (Ubuntu)"],"x-frame-options":["SAMEORIGIN"],"referrer-policy":["strict-origin-when-cross-origin"],"cross-origin-opener-policy":["same-origin"],"X-Powered-By":["JoomlaAPI/1.0"],"Expires":["Wed, 17 Aug 2005 00:00:00 GMT"],"Last-Modified":["Tue, 01 Sep 2020 09:51:34 GMT"],"Cache-Control":["no-store, no-cache, must-revalidate, post-check=0, pre-check=0"],"Pragma":["no-cache"],"Content-Length":["383"],"Content-Type":["application/vnd.api+json; charset=utf-8"]}
  [Response] {"links":{"self":"http://localhost/joomla-cms4/api/index.php/v1/banners/categories"},"data":{"type":"categories","id":"9","attributes":{"parent_id":3,"level":2,"lft":4,"rgt":5,"alias":"a-test-category","id":9,"extension":"com_banners","title":"A test category","note":"","published":0,"checked_out":null,"checked_out_time":null,"access":1,"created_user_id":3,"language":""}}}
 I see response code is 200
 I grab data from response by json path "$.data.id"
 I am bearer authenticated "c2hhMjU2OjM6ZTJmMjJlYTNlNTU0NmM1MDJhYTIzYzMwN2Mx..."
 I have http header "Accept","application/vnd.api+json"
 I send get "/banners/categories/9"
  [Request] GET http://localhost/joomla-cms4/api/index.php/v1/banners/categories/9
  [Request Headers] {"Authorization":"Bearer c2hhMjU2OjM6ZTJmMjJlYTNlNTU0NmM1MDJhYTIzYzMwN2MxYzAwZTQ5NzJhMWRmOTUyNjY5MTk2YjE5ODJmZWMwZTcxNzgwMQ==","Content-Type":"application/json","Accept":"application/vnd.api+json"}
  [Page] http://localhost/joomla-cms4/api/index.php/v1/banners/categories/9
  [Response] 200
  [Request Cookies] []
  [Response Headers] {"Date":["Tue, 01 Sep 2020 09:51:34 GMT"],"Server":["Apache/2.4.29 (Ubuntu)"],"x-frame-options":["SAMEORIGIN"],"referrer-policy":["strict-origin-when-cross-origin"],"cross-origin-opener-policy":["same-origin"],"X-Powered-By":["JoomlaAPI/1.0"],"Expires":["Wed, 17 Aug 2005 00:00:00 GMT"],"Last-Modified":["Tue, 01 Sep 2020 09:51:34 GMT"],"Cache-Control":["no-store, no-cache, must-revalidate, post-check=0, pre-check=0"],"Pragma":["no-cache"],"Content-Length":["386"],"Content-Type":["application/vnd.api+json; charset=utf-8"]}
  [Response] {"links":{"self":"http://localhost/joomla-cms4/api/index.php/v1/banners/categories/9"},"data":{"type":"categories","id":"9","attributes":{"parent_id":3,"level":2,"lft":4,"rgt":5,"alias":"a-test-category","id":9,"extension":"com_banners","title":"A test category","note":"","published":0,"checked_out":null,"checked_out_time":null,"access":1,"created_user_id":3,"language":""}}}
 I see response code is 200
 I am bearer authenticated "c2hhMjU2OjM6ZTJmMjJlYTNlNTU0NmM1MDJhYTIzYzMwN2Mx..."
 I have http header "Content-Type","application/json"
 I have http header "Accept","application/vnd.api+json"
 I send patch "/banners/categories/9",{"title":"Another Title","published":-2}
  [Request] PATCH http://localhost/joomla-cms4/api/index.php/v1/banners/categories/9 {"title":"Another Title","published":-2}
  [Request Headers] {"Authorization":"Bearer c2hhMjU2OjM6ZTJmMjJlYTNlNTU0NmM1MDJhYTIzYzMwN2MxYzAwZTQ5NzJhMWRmOTUyNjY5MTk2YjE5ODJmZWMwZTcxNzgwMQ==","Content-Type":"application/json","Accept":"application/vnd.api+json"}
  [Page] http://localhost/joomla-cms4/api/index.php/v1/banners/categories/9
  [Response] 200
  [Request Cookies] []
  [Response Headers] {"Date":["Tue, 01 Sep 2020 09:51:34 GMT"],"Server":["Apache/2.4.29 (Ubuntu)"],"x-frame-options":["SAMEORIGIN"],"referrer-policy":["strict-origin-when-cross-origin"],"cross-origin-opener-policy":["same-origin"],"X-Powered-By":["JoomlaAPI/1.0"],"Expires":["Wed, 17 Aug 2005 00:00:00 GMT"],"Last-Modified":["Tue, 01 Sep 2020 09:51:34 GMT"],"Cache-Control":["no-store, no-cache, must-revalidate, post-check=0, pre-check=0"],"Pragma":["no-cache"],"Content-Length":["2"],"Content-Type":["application/vnd.api+json; charset=utf-8"]}
  [Response] []
 I see response code is 200
 I am bearer authenticated "c2hhMjU2OjM6ZTJmMjJlYTNlNTU0NmM1MDJhYTIzYzMwN2Mx..."
 I have http header "Accept","application/vnd.api+json"
 I send delete "/banners/categories/9"
  [Request] DELETE http://localhost/joomla-cms4/api/index.php/v1/banners/categories/9 []
  [Request Headers] {"Authorization":"Bearer c2hhMjU2OjM6ZTJmMjJlYTNlNTU0NmM1MDJhYTIzYzMwN2MxYzAwZTQ5NzJhMWRmOTUyNjY5MTk2YjE5ODJmZWMwZTcxNzgwMQ==","Content-Type":"application/json","Accept":"application/vnd.api+json"}
  [Page] http://localhost/joomla-cms4/api/index.php/v1/banners/categories/9
  [Response] 204
  [Request Cookies] []
  [Response Headers] {"Date":["Tue, 01 Sep 2020 09:51:34 GMT"],"Server":["Apache/2.4.29 (Ubuntu)"],"x-frame-options":["SAMEORIGIN"],"referrer-policy":["strict-origin-when-cross-origin"],"cross-origin-opener-policy":["same-origin"],"X-Powered-By":["JoomlaAPI/1.0"],"Expires":["Wed, 17 Aug 2005 00:00:00 GMT"],"Last-Modified":["Tue, 01 Sep 2020 09:51:34 GMT"],"Cache-Control":["no-store, no-cache, must-revalidate, post-check=0, pre-check=0"],"Pragma":["no-cache"],"Content-Type":["text/html"]}
  [Response] 
 I see response code is 204
 PASSED 

ContactCest: Test crud on contact
Signature: ContactCest:testCrudOnContact
Test: tests/Codeception/api/com_contact/ContactCest.php:testCrudOnContact
Scenario --
 I update in database "users",{"id":3},[]
  [Query] UPDATE `c4in8_users` SET `id` = ? 
  [Parameters] [3]
 I update in database "user_usergroup_map",{"user_id":3},[]
  [Query] UPDATE `c4in8_user_usergroup_map` SET `user_id` = ? 
  [Parameters] [3]
 I have in database "user_profiles",{"user_id":3,"profile_key":"joomlatoken....}
  [Query] INSERT INTO `c4in8_user_profiles` (`user_id`, `profile_key`, `profile_value`) VALUES (?, ?, ?)
  [Parameters] [3,"joomlatoken.enabled",1]
 I have in database "user_profiles",{"user_id":3,"profile_key":"joomlatoken....}
  [Query] INSERT INTO `c4in8_user_profiles` (`user_id`, `profile_key`, `profile_value`) VALUES (?, ?, ?)
  [Parameters] [3,"joomlatoken.token","dOi2m1NRrnBHlhaWK/WWxh3B5tqq1INbdf4DhUmYTI4="]
 I am bearer authenticated "c2hhMjU2OjM6ZTJmMjJlYTNlNTU0NmM1MDJhYTIzYzMwN2Mx..."
 I have http header "Content-Type","application/json"
 I have http header "Accept","application/vnd.api+json"
 I send post "/contact",{"alias":"contact-the-ceo","catid":4,"language":"*",...}
  [Request] POST http://localhost/joomla-cms4/api/index.php/v1/contact {"alias":"contact-the-ceo","catid":4,"language":"*","name":"Francine Blogs"}
  [Request Headers] {"Authorization":"Bearer c2hhMjU2OjM6ZTJmMjJlYTNlNTU0NmM1MDJhYTIzYzMwN2MxYzAwZTQ5NzJhMWRmOTUyNjY5MTk2YjE5ODJmZWMwZTcxNzgwMQ==","Content-Type":"application/json","Accept":"application/vnd.api+json"}
  [Page] http://localhost/joomla-cms4/api/index.php/v1/contact
  [Response] 200
  [Request Cookies] []
  [Response Headers] {"Date":["Tue, 01 Sep 2020 09:51:35 GMT"],"Server":["Apache/2.4.29 (Ubuntu)"],"x-frame-options":["SAMEORIGIN"],"referrer-policy":["strict-origin-when-cross-origin"],"cross-origin-opener-policy":["same-origin"],"X-Powered-By":["JoomlaAPI/1.0"],"Expires":["Wed, 17 Aug 2005 00:00:00 GMT"],"Last-Modified":["Tue, 01 Sep 2020 09:51:35 GMT"],"Cache-Control":["no-store, no-cache, must-revalidate, post-check=0, pre-check=0"],"Pragma":["no-cache"],"Content-Length":["231"],"Content-Type":["application/vnd.api+json; charset=utf-8"]}
  [Response] {"links":{"self":"http://localhost/joomla-cms4/api/index.php/v1/contact"},"data":{"type":"contacts","id":"1","attributes":{"id":1,"name":"Francine Blogs","alias":"contact-the-ceo","catid":4,"created":"2020-09-01 09:51:35"}}}
 I see response code is 200
 I am bearer authenticated "c2hhMjU2OjM6ZTJmMjJlYTNlNTU0NmM1MDJhYTIzYzMwN2Mx..."
 I have http header "Accept","application/vnd.api+json"
 I send get "/contact/1"
  [Request] GET http://localhost/joomla-cms4/api/index.php/v1/contact/1
  [Request Headers] {"Authorization":"Bearer c2hhMjU2OjM6ZTJmMjJlYTNlNTU0NmM1MDJhYTIzYzMwN2MxYzAwZTQ5NzJhMWRmOTUyNjY5MTk2YjE5ODJmZWMwZTcxNzgwMQ==","Content-Type":"application/json","Accept":"application/vnd.api+json"}
  [Page] http://localhost/joomla-cms4/api/index.php/v1/contact/1
  [Response] 200
  [Request Cookies] []
  [Response Headers] {"Date":["Tue, 01 Sep 2020 09:51:35 GMT"],"Server":["Apache/2.4.29 (Ubuntu)"],"x-frame-options":["SAMEORIGIN"],"referrer-policy":["strict-origin-when-cross-origin"],"cross-origin-opener-policy":["same-origin"],"X-Powered-By":["JoomlaAPI/1.0"],"Expires":["Wed, 17 Aug 2005 00:00:00 GMT"],"Last-Modified":["Tue, 01 Sep 2020 09:51:35 GMT"],"Cache-Control":["no-store, no-cache, must-revalidate, post-check=0, pre-check=0"],"Pragma":["no-cache"],"Content-Length":["234"],"Content-Type":["application/vnd.api+json; charset=utf-8"]}
  [Response] {"links":{"self":"http://localhost/joomla-cms4/api/index.php/v1/contact/1"},"data":{"type":"contacts","id":"1","attributes":{"id":1,"name":"Francine Blogs","alias":"contact-the-ceo","catid":4,"created":"2020-09-01 09:51:35"}}}
 I see response code is 200
 I am bearer authenticated "c2hhMjU2OjM6ZTJmMjJlYTNlNTU0NmM1MDJhYTIzYzMwN2Mx..."
 I have http header "Content-Type","application/json"
 I have http header "Accept","application/vnd.api+json"
 I send patch "/contact/1",{"name":"Frankie Blogs","catid":4,"published":-2}
  [Request] PATCH http://localhost/joomla-cms4/api/index.php/v1/contact/1 {"name":"Frankie Blogs","catid":4,"published":-2}
  [Request Headers] {"Authorization":"Bearer c2hhMjU2OjM6ZTJmMjJlYTNlNTU0NmM1MDJhYTIzYzMwN2MxYzAwZTQ5NzJhMWRmOTUyNjY5MTk2YjE5ODJmZWMwZTcxNzgwMQ==","Content-Type":"application/json","Accept":"application/vnd.api+json"}
  [Page] http://localhost/joomla-cms4/api/index.php/v1/contact/1
  [Response] 200
  [Request Cookies] []
  [Response Headers] {"Date":["Tue, 01 Sep 2020 09:51:35 GMT"],"Server":["Apache/2.4.29 (Ubuntu)"],"x-frame-options":["SAMEORIGIN"],"referrer-policy":["strict-origin-when-cross-origin"],"cross-origin-opener-policy":["same-origin"],"X-Powered-By":["JoomlaAPI/1.0"],"Expires":["Wed, 17 Aug 2005 00:00:00 GMT"],"Last-Modified":["Tue, 01 Sep 2020 09:51:36 GMT"],"Cache-Control":["no-store, no-cache, must-revalidate, post-check=0, pre-check=0"],"Pragma":["no-cache"],"Content-Length":["2"],"Content-Type":["application/vnd.api+json; charset=utf-8"]}
  [Response] []
 I see response code is 200
 I am bearer authenticated "c2hhMjU2OjM6ZTJmMjJlYTNlNTU0NmM1MDJhYTIzYzMwN2Mx..."
 I have http header "Accept","application/vnd.api+json"
 I send delete "/contact/1"
  [Request] DELETE http://localhost/joomla-cms4/api/index.php/v1/contact/1 []
  [Request Headers] {"Authorization":"Bearer c2hhMjU2OjM6ZTJmMjJlYTNlNTU0NmM1MDJhYTIzYzMwN2MxYzAwZTQ5NzJhMWRmOTUyNjY5MTk2YjE5ODJmZWMwZTcxNzgwMQ==","Content-Type":"application/json","Accept":"application/vnd.api+json"}
  [Page] http://localhost/joomla-cms4/api/index.php/v1/contact/1
  [Response] 204
  [Request Cookies] []
  [Response Headers] {"Date":["Tue, 01 Sep 2020 09:51:36 GMT"],"Server":["Apache/2.4.29 (Ubuntu)"],"x-frame-options":["SAMEORIGIN"],"referrer-policy":["strict-origin-when-cross-origin"],"cross-origin-opener-policy":["same-origin"],"X-Powered-By":["JoomlaAPI/1.0"],"Expires":["Wed, 17 Aug 2005 00:00:00 GMT"],"Last-Modified":["Tue, 01 Sep 2020 09:51:36 GMT"],"Cache-Control":["no-store, no-cache, must-revalidate, post-check=0, pre-check=0"],"Pragma":["no-cache"],"Content-Type":["text/html"]}
  [Response] 
 I see response code is 204
 PASSED 

ContactCest: Test crud on category
Signature: ContactCest:testCrudOnCategory
Test: tests/Codeception/api/com_contact/ContactCest.php:testCrudOnCategory
Scenario --
 I update in database "users",{"id":3},[]
  [Query] UPDATE `c4in8_users` SET `id` = ? 
  [Parameters] [3]
 I update in database "user_usergroup_map",{"user_id":3},[]
  [Query] UPDATE `c4in8_user_usergroup_map` SET `user_id` = ? 
  [Parameters] [3]
 I have in database "user_profiles",{"user_id":3,"profile_key":"joomlatoken....}
  [Query] INSERT INTO `c4in8_user_profiles` (`user_id`, `profile_key`, `profile_value`) VALUES (?, ?, ?)
  [Parameters] [3,"joomlatoken.enabled",1]
 I have in database "user_profiles",{"user_id":3,"profile_key":"joomlatoken....}
  [Query] INSERT INTO `c4in8_user_profiles` (`user_id`, `profile_key`, `profile_value`) VALUES (?, ?, ?)
  [Parameters] [3,"joomlatoken.token","dOi2m1NRrnBHlhaWK/WWxh3B5tqq1INbdf4DhUmYTI4="]
 I am bearer authenticated "c2hhMjU2OjM6ZTJmMjJlYTNlNTU0NmM1MDJhYTIzYzMwN2Mx..."
 I have http header "Content-Type","application/json"
 I have http header "Accept","application/vnd.api+json"
 I send post "/contact/categories",{"title":"A test category","parent_id":4,...}
  [Request] POST http://localhost/joomla-cms4/api/index.php/v1/contact/categories {"title":"A test category","parent_id":4,"params":{"workflow_id":"inherit"}}
  [Request Headers] {"Authorization":"Bearer c2hhMjU2OjM6ZTJmMjJlYTNlNTU0NmM1MDJhYTIzYzMwN2MxYzAwZTQ5NzJhMWRmOTUyNjY5MTk2YjE5ODJmZWMwZTcxNzgwMQ==","Content-Type":"application/json","Accept":"application/vnd.api+json"}
  [Page] http://localhost/joomla-cms4/api/index.php/v1/contact/categories
  [Response] 200
  [Request Cookies] []
  [Response Headers] {"Date":["Tue, 01 Sep 2020 09:51:36 GMT"],"Server":["Apache/2.4.29 (Ubuntu)"],"x-frame-options":["SAMEORIGIN"],"referrer-policy":["strict-origin-when-cross-origin"],"cross-origin-opener-policy":["same-origin"],"X-Powered-By":["JoomlaAPI/1.0"],"Expires":["Wed, 17 Aug 2005 00:00:00 GMT"],"Last-Modified":["Tue, 01 Sep 2020 09:51:36 GMT"],"Cache-Control":["no-store, no-cache, must-revalidate, post-check=0, pre-check=0"],"Pragma":["no-cache"],"Content-Length":["385"],"Content-Type":["application/vnd.api+json; charset=utf-8"]}
  [Response] {"links":{"self":"http://localhost/joomla-cms4/api/index.php/v1/contact/categories"},"data":{"type":"categories","id":"10","attributes":{"parent_id":4,"level":2,"lft":6,"rgt":7,"alias":"a-test-category","id":10,"extension":"com_contact","title":"A test category","note":"","published":0,"checked_out":null,"checked_out_time":null,"access":1,"created_user_id":3,"language":""}}}
 I see response code is 200
 I grab data from response by json path "$.data.id"
 I am bearer authenticated "c2hhMjU2OjM6ZTJmMjJlYTNlNTU0NmM1MDJhYTIzYzMwN2Mx..."
 I have http header "Accept","application/vnd.api+json"
 I send get "/contact/categories/10"
  [Request] GET http://localhost/joomla-cms4/api/index.php/v1/contact/categories/10
  [Request Headers] {"Authorization":"Bearer c2hhMjU2OjM6ZTJmMjJlYTNlNTU0NmM1MDJhYTIzYzMwN2MxYzAwZTQ5NzJhMWRmOTUyNjY5MTk2YjE5ODJmZWMwZTcxNzgwMQ==","Content-Type":"application/json","Accept":"application/vnd.api+json"}
  [Page] http://localhost/joomla-cms4/api/index.php/v1/contact/categories/10
  [Response] 200
  [Request Cookies] []
  [Response Headers] {"Date":["Tue, 01 Sep 2020 09:51:36 GMT"],"Server":["Apache/2.4.29 (Ubuntu)"],"x-frame-options":["SAMEORIGIN"],"referrer-policy":["strict-origin-when-cross-origin"],"cross-origin-opener-policy":["same-origin"],"X-Powered-By":["JoomlaAPI/1.0"],"Expires":["Wed, 17 Aug 2005 00:00:00 GMT"],"Last-Modified":["Tue, 01 Sep 2020 09:51:36 GMT"],"Cache-Control":["no-store, no-cache, must-revalidate, post-check=0, pre-check=0"],"Pragma":["no-cache"],"Content-Length":["389"],"Content-Type":["application/vnd.api+json; charset=utf-8"]}
  [Response] {"links":{"self":"http://localhost/joomla-cms4/api/index.php/v1/contact/categories/10"},"data":{"type":"categories","id":"10","attributes":{"parent_id":4,"level":2,"lft":6,"rgt":7,"alias":"a-test-category","id":10,"extension":"com_contact","title":"A test category","note":"","published":0,"checked_out":null,"checked_out_time":null,"access":1,"created_user_id":3,"language":""}}}
 I see response code is 200
 I am bearer authenticated "c2hhMjU2OjM6ZTJmMjJlYTNlNTU0NmM1MDJhYTIzYzMwN2Mx..."
 I have http header "Content-Type","application/json"
 I have http header "Accept","application/vnd.api+json"
 I send patch "/contact/categories/10",{"title":"Another Title","published":-2}
  [Request] PATCH http://localhost/joomla-cms4/api/index.php/v1/contact/categories/10 {"title":"Another Title","published":-2}
  [Request Headers] {"Authorization":"Bearer c2hhMjU2OjM6ZTJmMjJlYTNlNTU0NmM1MDJhYTIzYzMwN2MxYzAwZTQ5NzJhMWRmOTUyNjY5MTk2YjE5ODJmZWMwZTcxNzgwMQ==","Content-Type":"application/json","Accept":"application/vnd.api+json"}
  [Page] http://localhost/joomla-cms4/api/index.php/v1/contact/categories/10
  [Response] 200
  [Request Cookies] []
  [Response Headers] {"Date":["Tue, 01 Sep 2020 09:51:36 GMT"],"Server":["Apache/2.4.29 (Ubuntu)"],"x-frame-options":["SAMEORIGIN"],"referrer-policy":["strict-origin-when-cross-origin"],"cross-origin-opener-policy":["same-origin"],"X-Powered-By":["JoomlaAPI/1.0"],"Expires":["Wed, 17 Aug 2005 00:00:00 GMT"],"Last-Modified":["Tue, 01 Sep 2020 09:51:37 GMT"],"Cache-Control":["no-store, no-cache, must-revalidate, post-check=0, pre-check=0"],"Pragma":["no-cache"],"Content-Length":["2"],"Content-Type":["application/vnd.api+json; charset=utf-8"]}
  [Response] []
 I see response code is 200
 I am bearer authenticated "c2hhMjU2OjM6ZTJmMjJlYTNlNTU0NmM1MDJhYTIzYzMwN2Mx..."
 I have http header "Accept","application/vnd.api+json"
 I send delete "/contact/categories/10"
  [Request] DELETE http://localhost/joomla-cms4/api/index.php/v1/contact/categories/10 []
  [Request Headers] {"Authorization":"Bearer c2hhMjU2OjM6ZTJmMjJlYTNlNTU0NmM1MDJhYTIzYzMwN2MxYzAwZTQ5NzJhMWRmOTUyNjY5MTk2YjE5ODJmZWMwZTcxNzgwMQ==","Content-Type":"application/json","Accept":"application/vnd.api+json"}
  [Page] http://localhost/joomla-cms4/api/index.php/v1/contact/categories/10
  [Response] 204
  [Request Cookies] []
  [Response Headers] {"Date":["Tue, 01 Sep 2020 09:51:37 GMT"],"Server":["Apache/2.4.29 (Ubuntu)"],"x-frame-options":["SAMEORIGIN"],"referrer-policy":["strict-origin-when-cross-origin"],"cross-origin-opener-policy":["same-origin"],"X-Powered-By":["JoomlaAPI/1.0"],"Expires":["Wed, 17 Aug 2005 00:00:00 GMT"],"Last-Modified":["Tue, 01 Sep 2020 09:51:37 GMT"],"Cache-Control":["no-store, no-cache, must-revalidate, post-check=0, pre-check=0"],"Pragma":["no-cache"],"Content-Type":["text/html"]}
  [Response] 
 I see response code is 204
 PASSED 

ContentCest: Test crud on article
Signature: ContentCest:testCrudOnArticle
Test: tests/Codeception/api/com_content/ContentCest.php:testCrudOnArticle
Scenario --
 I update in database "users",{"id":3},[]
  [Query] UPDATE `c4in8_users` SET `id` = ? 
  [Parameters] [3]
 I update in database "user_usergroup_map",{"user_id":3},[]
  [Query] UPDATE `c4in8_user_usergroup_map` SET `user_id` = ? 
  [Parameters] [3]
 I have in database "user_profiles",{"user_id":3,"profile_key":"joomlatoken....}
  [Query] INSERT INTO `c4in8_user_profiles` (`user_id`, `profile_key`, `profile_value`) VALUES (?, ?, ?)
  [Parameters] [3,"joomlatoken.enabled",1]
 I have in database "user_profiles",{"user_id":3,"profile_key":"joomlatoken....}
  [Query] INSERT INTO `c4in8_user_profiles` (`user_id`, `profile_key`, `profile_value`) VALUES (?, ?, ?)
  [Parameters] [3,"joomlatoken.token","dOi2m1NRrnBHlhaWK/WWxh3B5tqq1INbdf4DhUmYTI4="]
 I am bearer authenticated "c2hhMjU2OjM6ZTJmMjJlYTNlNTU0NmM1MDJhYTIzYzMwN2Mx..."
 I have http header "Content-Type","application/json"
 I have http header "Accept","application/vnd.api+json"
 I send post "/content/article",{"title":"Just for you","catid":2,"articlete...}
  [Request] POST http://localhost/joomla-cms4/api/index.php/v1/content/article {"title":"Just for you","catid":2,"articletext":"A dummy article to save to the database","language":"*","alias":"tobias"}
  [Request Headers] {"Authorization":"Bearer c2hhMjU2OjM6ZTJmMjJlYTNlNTU0NmM1MDJhYTIzYzMwN2MxYzAwZTQ5NzJhMWRmOTUyNjY5MTk2YjE5ODJmZWMwZTcxNzgwMQ==","Content-Type":"application/json","Accept":"application/vnd.api+json"}
  [Page] http://localhost/joomla-cms4/api/index.php/v1/content/article
  [Response] 200
  [Request Cookies] []
  [Response Headers] {"Date":["Tue, 01 Sep 2020 09:51:37 GMT"],"Server":["Apache/2.4.29 (Ubuntu)"],"x-frame-options":["SAMEORIGIN"],"referrer-policy":["strict-origin-when-cross-origin"],"cross-origin-opener-policy":["same-origin"],"X-Powered-By":["JoomlaAPI/1.0"],"Expires":["Wed, 17 Aug 2005 00:00:00 GMT"],"Last-Modified":["Tue, 01 Sep 2020 09:51:38 GMT"],"Cache-Control":["no-store, no-cache, must-revalidate, post-check=0, pre-check=0"],"Pragma":["no-cache"],"Content-Length":["748"],"Content-Type":["application/vnd.api+json; charset=utf-8"]}
  [Response] {"links":{"self":"http://localhost/joomla-cms4/api/index.php/v1/content/article"},"data":{"type":"articles","id":"1","attributes":{"typeAlias":"com_content.article","id":1,"asset_id":97,"title":"Just for you","alias":"tobias","state":0,"created":"2020-09-01 09:51:37","created_by":3,"created_by_alias":"","modified":"2020-09-01 09:51:37","modified_by":3,"publish_up":null,"publish_down":null,"images":[],"urls":[],"version":1,"metakey":"","metadesc":"","access":1,"hits":0,"metadata":[],"featured":0,"language":"*","note":"","tags":[],"featured_up":null,"featured_down":null,"text":"A dummy article to save to the database "},"relationships":{"category":{"data":{"type":"categories","id":"2"}},"author":{"data":{"type":"users","id":"3"}}}}}
 I see response code is 200
 I am bearer authenticated "c2hhMjU2OjM6ZTJmMjJlYTNlNTU0NmM1MDJhYTIzYzMwN2Mx..."
 I have http header "Accept","application/vnd.api+json"
 I send get "/content/article/1"
  [Request] GET http://localhost/joomla-cms4/api/index.php/v1/content/article/1
  [Request Headers] {"Authorization":"Bearer c2hhMjU2OjM6ZTJmMjJlYTNlNTU0NmM1MDJhYTIzYzMwN2MxYzAwZTQ5NzJhMWRmOTUyNjY5MTk2YjE5ODJmZWMwZTcxNzgwMQ==","Content-Type":"application/json","Accept":"application/vnd.api+json"}
  [Page] http://localhost/joomla-cms4/api/index.php/v1/content/article/1
  [Response] 200
  [Request Cookies] []
  [Response Headers] {"Date":["Tue, 01 Sep 2020 09:51:38 GMT"],"Server":["Apache/2.4.29 (Ubuntu)"],"x-frame-options":["SAMEORIGIN"],"referrer-policy":["strict-origin-when-cross-origin"],"cross-origin-opener-policy":["same-origin"],"X-Powered-By":["JoomlaAPI/1.0"],"Expires":["Wed, 17 Aug 2005 00:00:00 GMT"],"Last-Modified":["Tue, 01 Sep 2020 09:51:38 GMT"],"Cache-Control":["no-store, no-cache, must-revalidate, post-check=0, pre-check=0"],"Pragma":["no-cache"],"Content-Length":["751"],"Content-Type":["application/vnd.api+json; charset=utf-8"]}
  [Response] {"links":{"self":"http://localhost/joomla-cms4/api/index.php/v1/content/article/1"},"data":{"type":"articles","id":"1","attributes":{"typeAlias":"com_content.article","id":1,"asset_id":97,"title":"Just for you","alias":"tobias","state":0,"created":"2020-09-01 09:51:37","created_by":3,"created_by_alias":"","modified":"2020-09-01 09:51:37","modified_by":3,"publish_up":null,"publish_down":null,"images":[],"urls":[],"version":1,"metakey":"","metadesc":"","access":1,"hits":0,"metadata":[],"featured":0,"language":"*","note":"","tags":[],"featured_up":null,"featured_down":null,"text":"A dummy article to save to the database "},"relationships":{"category":{"data":{"type":"categories","id":"2"}},"author":{"data":{"type":"users","id":"3"}}}}}
 I see response code is 200
 I am bearer authenticated "c2hhMjU2OjM6ZTJmMjJlYTNlNTU0NmM1MDJhYTIzYzMwN2Mx..."
 I have http header "Content-Type","application/json"
 I have http header "Accept","application/vnd.api+json"
 I send patch "/content/article/1",{"title":"Another Title","catid":2}
  [Request] PATCH http://localhost/joomla-cms4/api/index.php/v1/content/article/1 {"title":"Another Title","catid":2}
  [Request Headers] {"Authorization":"Bearer c2hhMjU2OjM6ZTJmMjJlYTNlNTU0NmM1MDJhYTIzYzMwN2MxYzAwZTQ5NzJhMWRmOTUyNjY5MTk2YjE5ODJmZWMwZTcxNzgwMQ==","Content-Type":"application/json","Accept":"application/vnd.api+json"}
  [Page] http://localhost/joomla-cms4/api/index.php/v1/content/article/1
  [Response] 200
  [Request Cookies] []
  [Response Headers] {"Date":["Tue, 01 Sep 2020 09:51:38 GMT"],"Server":["Apache/2.4.29 (Ubuntu)"],"x-frame-options":["SAMEORIGIN"],"referrer-policy":["strict-origin-when-cross-origin"],"cross-origin-opener-policy":["same-origin"],"X-Powered-By":["JoomlaAPI/1.0"],"Expires":["Wed, 17 Aug 2005 00:00:00 GMT"],"Last-Modified":["Tue, 01 Sep 2020 09:51:38 GMT"],"Cache-Control":["no-store, no-cache, must-revalidate, post-check=0, pre-check=0"],"Pragma":["no-cache"],"Content-Length":["2"],"Content-Type":["application/vnd.api+json; charset=utf-8"]}
  [Response] []
 I see response code is 200
 I am bearer authenticated "c2hhMjU2OjM6ZTJmMjJlYTNlNTU0NmM1MDJhYTIzYzMwN2Mx..."
 I have http header "Accept","application/vnd.api+json"
 I send delete "/content/article/1"
  [Request] DELETE http://localhost/joomla-cms4/api/index.php/v1/content/article/1 []
  [Request Headers] {"Authorization":"Bearer c2hhMjU2OjM6ZTJmMjJlYTNlNTU0NmM1MDJhYTIzYzMwN2MxYzAwZTQ5NzJhMWRmOTUyNjY5MTk2YjE5ODJmZWMwZTcxNzgwMQ==","Content-Type":"application/json","Accept":"application/vnd.api+json"}
  [Page] http://localhost/joomla-cms4/api/index.php/v1/content/article/1
  [Response] 204
  [Request Cookies] []
  [Response Headers] {"Date":["Tue, 01 Sep 2020 09:51:38 GMT"],"Server":["Apache/2.4.29 (Ubuntu)"],"x-frame-options":["SAMEORIGIN"],"referrer-policy":["strict-origin-when-cross-origin"],"cross-origin-opener-policy":["same-origin"],"X-Powered-By":["JoomlaAPI/1.0"],"Expires":["Wed, 17 Aug 2005 00:00:00 GMT"],"Last-Modified":["Tue, 01 Sep 2020 09:51:38 GMT"],"Cache-Control":["no-store, no-cache, must-revalidate, post-check=0, pre-check=0"],"Pragma":["no-cache"],"Content-Type":["text/html"]}
  [Response] 
 I see response code is 204
 PASSED 

ContentCest: Test crud on category
Signature: ContentCest:testCrudOnCategory
Test: tests/Codeception/api/com_content/ContentCest.php:testCrudOnCategory
Scenario --
 I update in database "users",{"id":3},[]
  [Query] UPDATE `c4in8_users` SET `id` = ? 
  [Parameters] [3]
 I update in database "user_usergroup_map",{"user_id":3},[]
  [Query] UPDATE `c4in8_user_usergroup_map` SET `user_id` = ? 
  [Parameters] [3]
 I have in database "user_profiles",{"user_id":3,"profile_key":"joomlatoken....}
  [Query] INSERT INTO `c4in8_user_profiles` (`user_id`, `profile_key`, `profile_value`) VALUES (?, ?, ?)
  [Parameters] [3,"joomlatoken.enabled",1]
 I have in database "user_profiles",{"user_id":3,"profile_key":"joomlatoken....}
  [Query] INSERT INTO `c4in8_user_profiles` (`user_id`, `profile_key`, `profile_value`) VALUES (?, ?, ?)
  [Parameters] [3,"joomlatoken.token","dOi2m1NRrnBHlhaWK/WWxh3B5tqq1INbdf4DhUmYTI4="]
 I am bearer authenticated "c2hhMjU2OjM6ZTJmMjJlYTNlNTU0NmM1MDJhYTIzYzMwN2Mx..."
 I have http header "Content-Type","application/json"
 I have http header "Accept","application/vnd.api+json"
 I send post "/content/categories",{"title":"A test category","parent_id":2,...}
  [Request] POST http://localhost/joomla-cms4/api/index.php/v1/content/categories {"title":"A test category","parent_id":2,"params":{"workflow_id":"inherit"}}
  [Request Headers] {"Authorization":"Bearer c2hhMjU2OjM6ZTJmMjJlYTNlNTU0NmM1MDJhYTIzYzMwN2MxYzAwZTQ5NzJhMWRmOTUyNjY5MTk2YjE5ODJmZWMwZTcxNzgwMQ==","Content-Type":"application/json","Accept":"application/vnd.api+json"}
  [Page] http://localhost/joomla-cms4/api/index.php/v1/content/categories
  [Response] 200
  [Request Cookies] []
  [Response Headers] {"Date":["Tue, 01 Sep 2020 09:51:39 GMT"],"Server":["Apache/2.4.29 (Ubuntu)"],"x-frame-options":["SAMEORIGIN"],"referrer-policy":["strict-origin-when-cross-origin"],"cross-origin-opener-policy":["same-origin"],"X-Powered-By":["JoomlaAPI/1.0"],"Expires":["Wed, 17 Aug 2005 00:00:00 GMT"],"Last-Modified":["Tue, 01 Sep 2020 09:51:39 GMT"],"Cache-Control":["no-store, no-cache, must-revalidate, post-check=0, pre-check=0"],"Pragma":["no-cache"],"Content-Length":["385"],"Content-Type":["application/vnd.api+json; charset=utf-8"]}
  [Response] {"links":{"self":"http://localhost/joomla-cms4/api/index.php/v1/content/categories"},"data":{"type":"categories","id":"11","attributes":{"parent_id":2,"level":2,"lft":2,"rgt":3,"alias":"a-test-category","id":11,"extension":"com_content","title":"A test category","note":"","published":0,"checked_out":null,"checked_out_time":null,"access":1,"created_user_id":3,"language":""}}}
 I see response code is 200
 I grab data from response by json path "$.data.id"
 I am bearer authenticated "c2hhMjU2OjM6ZTJmMjJlYTNlNTU0NmM1MDJhYTIzYzMwN2Mx..."
 I have http header "Accept","application/vnd.api+json"
 I send get "/content/categories/11"
  [Request] GET http://localhost/joomla-cms4/api/index.php/v1/content/categories/11
  [Request Headers] {"Authorization":"Bearer c2hhMjU2OjM6ZTJmMjJlYTNlNTU0NmM1MDJhYTIzYzMwN2MxYzAwZTQ5NzJhMWRmOTUyNjY5MTk2YjE5ODJmZWMwZTcxNzgwMQ==","Content-Type":"application/json","Accept":"application/vnd.api+json"}
  [Page] http://localhost/joomla-cms4/api/index.php/v1/content/categories/11
  [Response] 200
  [Request Cookies] []
  [Response Headers] {"Date":["Tue, 01 Sep 2020 09:51:39 GMT"],"Server":["Apache/2.4.29 (Ubuntu)"],"x-frame-options":["SAMEORIGIN"],"referrer-policy":["strict-origin-when-cross-origin"],"cross-origin-opener-policy":["same-origin"],"X-Powered-By":["JoomlaAPI/1.0"],"Expires":["Wed, 17 Aug 2005 00:00:00 GMT"],"Last-Modified":["Tue, 01 Sep 2020 09:51:39 GMT"],"Cache-Control":["no-store, no-cache, must-revalidate, post-check=0, pre-check=0"],"Pragma":["no-cache"],"Content-Length":["389"],"Content-Type":["application/vnd.api+json; charset=utf-8"]}
  [Response] {"links":{"self":"http://localhost/joomla-cms4/api/index.php/v1/content/categories/11"},"data":{"type":"categories","id":"11","attributes":{"parent_id":2,"level":2,"lft":2,"rgt":3,"alias":"a-test-category","id":11,"extension":"com_content","title":"A test category","note":"","published":0,"checked_out":null,"checked_out_time":null,"access":1,"created_user_id":3,"language":""}}}
 I see response code is 200
 I am bearer authenticated "c2hhMjU2OjM6ZTJmMjJlYTNlNTU0NmM1MDJhYTIzYzMwN2Mx..."
 I have http header "Content-Type","application/json"
 I have http header "Accept","application/vnd.api+json"
 I send patch "/content/categories/11",{"title":"Another Title","params":{"w...}
  [Request] PATCH http://localhost/joomla-cms4/api/index.php/v1/content/categories/11 {"title":"Another Title","params":{"workflow_id":"inherit"},"published":-2}
  [Request Headers] {"Authorization":"Bearer c2hhMjU2OjM6ZTJmMjJlYTNlNTU0NmM1MDJhYTIzYzMwN2MxYzAwZTQ5NzJhMWRmOTUyNjY5MTk2YjE5ODJmZWMwZTcxNzgwMQ==","Content-Type":"application/json","Accept":"application/vnd.api+json"}
  [Page] http://localhost/joomla-cms4/api/index.php/v1/content/categories/11
  [Response] 200
  [Request Cookies] []
  [Response Headers] {"Date":["Tue, 01 Sep 2020 09:51:39 GMT"],"Server":["Apache/2.4.29 (Ubuntu)"],"x-frame-options":["SAMEORIGIN"],"referrer-policy":["strict-origin-when-cross-origin"],"cross-origin-opener-policy":["same-origin"],"X-Powered-By":["JoomlaAPI/1.0"],"Expires":["Wed, 17 Aug 2005 00:00:00 GMT"],"Last-Modified":["Tue, 01 Sep 2020 09:51:39 GMT"],"Cache-Control":["no-store, no-cache, must-revalidate, post-check=0, pre-check=0"],"Pragma":["no-cache"],"Content-Length":["2"],"Content-Type":["application/vnd.api+json; charset=utf-8"]}
  [Response] []
 I see response code is 200
 I am bearer authenticated "c2hhMjU2OjM6ZTJmMjJlYTNlNTU0NmM1MDJhYTIzYzMwN2Mx..."
 I have http header "Accept","application/vnd.api+json"
 I send delete "/content/categories/11"
  [Request] DELETE http://localhost/joomla-cms4/api/index.php/v1/content/categories/11 []
  [Request Headers] {"Authorization":"Bearer c2hhMjU2OjM6ZTJmMjJlYTNlNTU0NmM1MDJhYTIzYzMwN2MxYzAwZTQ5NzJhMWRmOTUyNjY5MTk2YjE5ODJmZWMwZTcxNzgwMQ==","Content-Type":"application/json","Accept":"application/vnd.api+json"}
  [Page] http://localhost/joomla-cms4/api/index.php/v1/content/categories/11
  [Response] 204
  [Request Cookies] []
  [Response Headers] {"Date":["Tue, 01 Sep 2020 09:51:39 GMT"],"Server":["Apache/2.4.29 (Ubuntu)"],"x-frame-options":["SAMEORIGIN"],"referrer-policy":["strict-origin-when-cross-origin"],"cross-origin-opener-policy":["same-origin"],"X-Powered-By":["JoomlaAPI/1.0"],"Expires":["Wed, 17 Aug 2005 00:00:00 GMT"],"Last-Modified":["Tue, 01 Sep 2020 09:51:40 GMT"],"Cache-Control":["no-store, no-cache, must-revalidate, post-check=0, pre-check=0"],"Pragma":["no-cache"],"Content-Type":["text/html"]}
  [Response] 
 I see response code is 204
 PASSED 

--------------------------------------------------------------------------------


Time: 8.63 seconds, Memory: 14.00 MB

OK (9 tests, 27 assertions)
  [Db] Disconnected from default

Command 'q' not found, but can be installed with:

sudo snap install q                       # version 1.6.3-1, or
sudo apt  install python-q-text-as-data 
sudo apt  install python3-q-text-as-data

See 'snap info q' for additional versions.


@astridx
Copy link
Contributor

astridx commented Sep 1, 2020

I have tested this item ✅ successfully on 4e4a360


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/26722.

@alikon
Copy link
Contributor

alikon commented Sep 1, 2020

RTC


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/26722.

@joomla-cms-bot joomla-cms-bot added RTC This Pull Request is Ready To Commit and removed Unit/System Tests labels Sep 1, 2020
@zero-24 zero-24 merged commit 73ae023 into joomla:4.0-dev Sep 1, 2020
@joomla-cms-bot joomla-cms-bot added Unit/System Tests and removed RTC This Pull Request is Ready To Commit labels Sep 1, 2020
@zero-24
Copy link
Contributor

zero-24 commented Sep 1, 2020

Thanks merged.

@zero-24 zero-24 added this to the Joomla 4.0 milestone Sep 1, 2020
dgrammatiko added a commit to dgrammatiko/joomla-cms that referenced this pull request Sep 29, 2020
…om_templates

* '4.0-dev' of github.com:joomla/joomla-cms: (70 commits)
  [4.0] Child templates consistency (joomla#30387)
  [4.0] favicon changes to support child templates (joomla#30388)
  [4.0] Update Readme for Api tests (joomla#30539)
  [4.0] [Multilingual Status module] Adding displaying a possible error if URL Language Code is empty (joomla#30537)
  [4.0] Display of horizontal mod_articles_news module (joomla#30527)
  [4.0] Useless installation lang strings (joomla#30568)
  [4.0] Numbers not digits (joomla#30559)
  [4.0] Accessibility plugin position (joomla#30552)
  [4.0] fix for inherit fields (joomla#30557)
  [4.0] Redundant words (joomla#30555)
  add missing legend to fieldset (joomla#30528)
  [4.0] [a11y] add statement on found results (joomla#30535)
  [4.0] com_finder ul instead of dl for easier styling (joomla#30534)
  [4.0] Messages/Alerts: using icons instead of text as heading (joomla#30516)
  [4.0] Increase API Test Coverage (joomla#26722)
  [4.0] Implementing display of password requirements for frontend (joomla#30473)
  [4.0] FieldsHelper: Choose a first available category  correctly (joomla#30268)
  Sort options (joomla#30531)
  Clear checkboxes on back button (joomla#30498)
  Update _icomoon.scss (joomla#30436)
  ...
sakiss pushed a commit to sakiss/joomla-cms that referenced this pull request Oct 16, 2020
* Add basic contact api tests

* Fix contact delete in the API

* Improve tests

* Update ContactModel.php

* Test for content categories

* Start work on tests for banners

* Move tests to bearer token approach

* Fix patch banner

* Fix category creation for non-content extensions

* Fix delete category

* Fix patch category

* State => published

* Don't hardcode catid for tests

* Debug

* Fix

* Fixes

* Fixes

* Append string

* Add catid to the update

* Fix auth

* Add workflow

* Trash article in the update
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants

Comments