Skip to content

Commit e663bd8

Browse files
committed
make the scenario short
Signed-off-by: nabim777 <nabinalemagar019@gmail.com>
1 parent 6f0b174 commit e663bd8

2 files changed

Lines changed: 143 additions & 142 deletions

File tree

tests/acceptance/features/api/setup.feature

Lines changed: 138 additions & 138 deletions
Original file line numberDiff line numberDiff line change
@@ -505,140 +505,140 @@ Feature: setup the integration through an API
505505
}
506506
}
507507
"""
508-
Then the HTTP status code should be "200"
509-
And the data of the response should match
510-
""""
511-
{
512-
"type": "object",
513-
"required": [
514-
"nextcloud_oauth_client_name",
515-
"openproject_redirect_uri",
516-
"nextcloud_client_id",
517-
"nextcloud_client_secret",
518-
"openproject_user_app_password"
519-
],
520-
"properties": {
521-
"nextcloud_oauth_client_name": {"type": "string", "pattern": "^OpenProject client$"},
522-
"openproject_redirect_uri": {"type": "string", "pattern": "^http:\/\/some-host.de\/oauth_clients\/[A-Za-z0-9]+\/callback$"},
523-
"nextcloud_client_id": {"type": "string", "pattern": "[A-Za-z0-9]+"},
524-
"nextcloud_client_secret": {"type": "string", "pattern": "[A-Za-z0-9]+"},
525-
"openproject_user_app_password": {"type": "string", "pattern": "[A-Za-z0-9]+"}
526-
},
527-
"not": {
528-
"required": [
529-
"openproject_revocation_status"
530-
]
531-
}
532-
}
533-
"""
534-
And user "OpenProject" should be present in the server
535-
And group "OpenProject" should be present in the server
536-
And user "OpenProject" should be the subadmin of the group "OpenProject"
537-
And groupfolder "OpenProject" should be present in the server
538-
And groupfolder "OpenProject" should be assigned to the group "OpenProject" with all permissions
539-
And groupfolder "OpenProject" should have advance permissions enabled
540-
And groupfolder "OpenProject" should be managed by the user "OpenProject"
508+
# Then the HTTP status code should be "200"
509+
# And the data of the response should match
510+
# """"
511+
# {
512+
# "type": "object",
513+
# "required": [
514+
# "nextcloud_oauth_client_name",
515+
# "openproject_redirect_uri",
516+
# "nextcloud_client_id",
517+
# "nextcloud_client_secret",
518+
# "openproject_user_app_password"
519+
# ],
520+
# "properties": {
521+
# "nextcloud_oauth_client_name": {"type": "string", "pattern": "^OpenProject client$"},
522+
# "openproject_redirect_uri": {"type": "string", "pattern": "^http:\/\/some-host.de\/oauth_clients\/[A-Za-z0-9]+\/callback$"},
523+
# "nextcloud_client_id": {"type": "string", "pattern": "[A-Za-z0-9]+"},
524+
# "nextcloud_client_secret": {"type": "string", "pattern": "[A-Za-z0-9]+"},
525+
# "openproject_user_app_password": {"type": "string", "pattern": "[A-Za-z0-9]+"}
526+
# },
527+
# "not": {
528+
# "required": [
529+
# "openproject_revocation_status"
530+
# ]
531+
# }
532+
# }
533+
# """
534+
# And user "OpenProject" should be present in the server
535+
# And group "OpenProject" should be present in the server
536+
# And user "OpenProject" should be the subadmin of the group "OpenProject"
537+
# And groupfolder "OpenProject" should be present in the server
538+
# And groupfolder "OpenProject" should be assigned to the group "OpenProject" with all permissions
539+
# And groupfolder "OpenProject" should have advance permissions enabled
540+
# And groupfolder "OpenProject" should be managed by the user "OpenProject"
541541
# the next step is only for the tests, because that user has a random password
542-
Given the administrator has changed the password of "OpenProject" to the default testing password
543-
And user "OpenProject" should have a folder called "OpenProject"
542+
# Given the administrator has changed the password of "OpenProject" to the default testing password
543+
# And user "OpenProject" should have a folder called "OpenProject"
544544
# folders inside the OpenProject folder can only be deleted/renamed by the OpenProject user
545-
And user "Carol" has been created
546-
And user "Carol" has been added to the group "OpenProject"
547-
And user "OpenProject" has created folder "/OpenProject/project-abc"
548-
Then user "Carol" should have a folder called "OpenProject/project-abc"
549-
When user "Carol" deletes folder "/OpenProject/project-abc"
550-
Then the HTTP status code should be 500
551-
When user "Carol" renames folder "/OpenProject/project-abc" to "/OpenProject/project-123"
552-
Then the HTTP status code should be 500
553-
When user "OpenProject" renames folder "/OpenProject/project-abc" to "/OpenProject/project-123"
554-
Then the HTTP status code should be 201
555-
When user "OpenProject" deletes folder "/OpenProject/project-123"
556-
Then the HTTP status code should be 204
545+
# And user "Carol" has been created
546+
# And user "Carol" has been added to the group "OpenProject"
547+
# And user "OpenProject" has created folder "/OpenProject/project-abc"
548+
# Then user "Carol" should have a folder called "OpenProject/project-abc"
549+
# When user "Carol" deletes folder "/OpenProject/project-abc"
550+
# Then the HTTP status code should be 500
551+
# When user "Carol" renames folder "/OpenProject/project-abc" to "/OpenProject/project-123"
552+
# Then the HTTP status code should be 500
553+
# When user "OpenProject" renames folder "/OpenProject/project-abc" to "/OpenProject/project-123"
554+
# Then the HTTP status code should be 201
555+
# When user "OpenProject" deletes folder "/OpenProject/project-123"
556+
# Then the HTTP status code should be 204
557557

558558
# folders 2 levels down inside the OpenProject folder can be deleted by any user even if the parent is also called "OpenProject"
559-
Given user "OpenProject" has created folder "/OpenProject/OpenProject/project-abc"
560-
When user "Carol" renames folder "/OpenProject/OpenProject/project-abc" to "/OpenProject/OpenProject/project-123"
561-
Then the HTTP status code should be 201
562-
When user "Carol" deletes folder "/OpenProject/OpenProject/project-123"
563-
Then the HTTP status code should be 204
559+
# Given user "OpenProject" has created folder "/OpenProject/OpenProject/project-abc"
560+
# When user "Carol" renames folder "/OpenProject/OpenProject/project-abc" to "/OpenProject/OpenProject/project-123"
561+
# Then the HTTP status code should be 201
562+
# When user "Carol" deletes folder "/OpenProject/OpenProject/project-123"
563+
# Then the HTTP status code should be 204
564564

565565
# a user, who is not in the OpenProject group can delete/rename items inside a folder that is called OpenProject
566-
Given user "Brian" has been created
567-
And user "Brian" has created folder "/OpenProject/project-abc"
568-
When user "Brian" renames folder "/OpenProject/project-abc" to "/OpenProject/project-123"
569-
Then the HTTP status code should be 201
570-
When user "Brian" deletes folder "/OpenProject/project-123"
571-
Then the HTTP status code should be 204
566+
# Given user "Brian" has been created
567+
# And user "Brian" has created folder "/OpenProject/project-abc"
568+
# When user "Brian" renames folder "/OpenProject/project-abc" to "/OpenProject/project-123"
569+
# Then the HTTP status code should be 201
570+
# When user "Brian" deletes folder "/OpenProject/project-123"
571+
# Then the HTTP status code should be 204
572572

573573
# check deleting / disabling the OpenProject user/group
574-
When the administrator deletes the user "OpenProject"
575-
Then the HTTP status code should be 400
576-
And user "OpenProject" should be present in the server
577-
When the administrator deletes the group "OpenProject"
578-
Then the HTTP status code should be 400
579-
And group "OpenProject" should be present in the server
580-
When the administrator disables the user "OpenProject"
581-
Then the HTTP status code should be 400
574+
# When the administrator deletes the user "OpenProject"
575+
# Then the HTTP status code should be 400
576+
# And user "OpenProject" should be present in the server
577+
# When the administrator deletes the group "OpenProject"
578+
# Then the HTTP status code should be 400
579+
# And group "OpenProject" should be present in the server
580+
# When the administrator disables the user "OpenProject"
581+
# Then the HTTP status code should be 400
582582

583583
# resending setup request will fail
584-
When the administrator sends a POST request to the "setup" endpoint with this data:
585-
"""
586-
{
587-
"values" : {
588-
"openproject_instance_url": "http://some-host.de",
589-
"openproject_client_id": "the-client-id",
590-
"openproject_client_secret": "the-client-secret",
591-
"default_enable_navigation": false,
592-
"default_enable_unified_search": false,
593-
"setup_project_folder": true,
594-
"setup_app_password": true
595-
}
596-
}
597-
"""
598-
Then the HTTP status code should be "409"
599-
And the data of the response should match
600-
""""
601-
{
602-
"type": "object",
603-
"required": [
604-
"error"
605-
],
606-
"properties": {
607-
"error": {"type": "string", "pattern": "^The user \"OpenProject\" already exists$"}
608-
}
609-
}
610-
"""
584+
# When the administrator sends a POST request to the "setup" endpoint with this data:
585+
# """
586+
# {
587+
# "values" : {
588+
# "openproject_instance_url": "http://some-host.de",
589+
# "openproject_client_id": "the-client-id",
590+
# "openproject_client_secret": "the-client-secret",
591+
# "default_enable_navigation": false,
592+
# "default_enable_unified_search": false,
593+
# "setup_project_folder": true,
594+
# "setup_app_password": true
595+
# }
596+
# }
597+
# """
598+
# Then the HTTP status code should be "409"
599+
# And the data of the response should match
600+
# """"
601+
# {
602+
# "type": "object",
603+
# "required": [
604+
# "error"
605+
# ],
606+
# "properties": {
607+
# "error": {"type": "string", "pattern": "^The user \"OpenProject\" already exists$"}
608+
# }
609+
# }
610+
# """
611611

612612
# sending a PATCH request with setup_project_folder=true will also fail
613-
When the administrator sends a PATCH request to the "setup" endpoint with this data:
614-
"""
615-
{
616-
"values" : {
617-
"setup_project_folder": true
618-
}
619-
}
620-
"""
621-
Then the HTTP status code should be "409"
622-
And the data of the response should match
623-
""""
624-
{
625-
"type": "object",
626-
"required": [
627-
"error"
628-
],
629-
"properties": {
630-
"error": {"type": "string", "pattern": "^The user \"OpenProject\" already exists$"}
631-
}
632-
}
633-
"""
613+
# When the administrator sends a PATCH request to the "setup" endpoint with this data:
614+
# """
615+
# {
616+
# "values" : {
617+
# "setup_project_folder": true
618+
# }
619+
# }
620+
# """
621+
# Then the HTTP status code should be "409"
622+
# And the data of the response should match
623+
# """"
624+
# {
625+
# "type": "object",
626+
# "required": [
627+
# "error"
628+
# ],
629+
# "properties": {
630+
# "error": {"type": "string", "pattern": "^The user \"OpenProject\" already exists$"}
631+
# }
632+
# }
633+
# """
634634

635635
# we can make api request using the created app password for user "OpenProject"
636-
When user "OpenProject" sends a "PROPFIND" request to "/remote.php/webdav" using current app password
637-
Then the HTTP status code should be "207"
636+
# When user "OpenProject" sends a "PROPFIND" request to "/remote.php/webdav" using current app password
637+
# Then the HTTP status code should be "207"
638638

639639
# this is to provide test coverage for issues like this
640640
# https://community.openproject.org/projects/nextcloud-integration/work_packages/49621
641-
When a new browser session for "Openproject" starts
641+
# When a new browser session for "Openproject" starts
642642
# but other values can be updated by sending a PATCH request
643643
# also we can replace old app password by sending PATCH request to get new user app password
644644
And the administrator sends a PATCH request to the "setup" endpoint with this data:
@@ -650,29 +650,29 @@ Feature: setup the integration through an API
650650
}
651651
}
652652
"""
653-
Then the HTTP status code should be "200"
654-
And the data of the response should match
655-
""""
656-
{
657-
"type": "object",
658-
"required": [
659-
"nextcloud_oauth_client_name",
660-
"openproject_redirect_uri",
661-
"nextcloud_client_id"
662-
],
663-
"properties": {
664-
"nextcloud_oauth_client_name": {"type": "string", "pattern": "^OpenProject client$"},
665-
"openproject_redirect_uri": {"type": "string", "pattern": "^http:\/\/some-host.de\/oauth_clients\/[A-Za-z0-9]+\/callback$"},
666-
"nextcloud_client_id": {"type": "string", "pattern": "[A-Za-z0-9]+"},
667-
"openproject_user_app_password": {"type": "string", "pattern": "[A-Za-z0-9]+"}
668-
}
669-
}
670-
"""
671-
And the newly generated app password should be different from the previous one
653+
# Then the HTTP status code should be "200"
654+
# And the data of the response should match
655+
# """"
656+
# {
657+
# "type": "object",
658+
# "required": [
659+
# "nextcloud_oauth_client_name",
660+
# "openproject_redirect_uri",
661+
# "nextcloud_client_id"
662+
# ],
663+
# "properties": {
664+
# "nextcloud_oauth_client_name": {"type": "string", "pattern": "^OpenProject client$"},
665+
# "openproject_redirect_uri": {"type": "string", "pattern": "^http:\/\/some-host.de\/oauth_clients\/[A-Za-z0-9]+\/callback$"},
666+
# "nextcloud_client_id": {"type": "string", "pattern": "[A-Za-z0-9]+"},
667+
# "openproject_user_app_password": {"type": "string", "pattern": "[A-Za-z0-9]+"}
668+
# }
669+
# }
670+
# """
671+
# And the newly generated app password should be different from the previous one
672672

673673
# user "OpenProject" can make api request using the newly created app password
674-
When user "OpenProject" sends a "PROPFIND" request to "/remote.php/webdav" using new app password
675-
Then the HTTP status code should be "207"
674+
# When user "OpenProject" sends a "PROPFIND" request to "/remote.php/webdav" using new app password
675+
# Then the HTTP status code should be "207"
676676

677677
# user "OpenProject" cannot make api request using the old app password
678678
When user "OpenProject" sends a "PROPFIND" request to "/remote.php/webdav" using old app password

tests/acceptance/features/bootstrap/FeatureContext.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -805,9 +805,9 @@ public function sendHttpRequest(
805805
$response = $client->send($request);
806806
} catch (RequestException $ex) {
807807
$response = $ex->getResponse();
808-
var_dump("---Response-----");
809-
var_dump($response->getBody()->getContents());
810-
var_dump("----------------");
808+
// var_dump("---Response-----");
809+
// var_dump($response->getBody()->getContents());
810+
// var_dump("----------------");
811811
//if the response was null for some reason do not return it but re-throw
812812
if ($response === null) {
813813
throw $ex;
@@ -926,6 +926,7 @@ public function theUserSendsRequestTo(string $user, string $method, string $endp
926926
} else {
927927
$appPassword = $this->createdAppPasswords[1];
928928
}
929+
var_dump($appPassword);
929930
$this->response = $this->sendHttpRequest(
930931
self::sanitizeUrl($this->getBaseUrl() . $endpoint), $user, $appPassword, $method
931932
);
@@ -1084,7 +1085,7 @@ public function extractRequestTokenFromResponse(ResponseInterface $response):voi
10841085
* @param array<mixed>|PyStringNode|null|string $data //array for multipart data
10851086
* @param array<mixed>|null $headers //array for multipart data
10861087
* @return void
1087-
* @throws \GuzzleHttp\Exception\GuzzleException
1088+
* @throws GuzzleException
10881089
*/
10891090
public function sendRequestsToAppEndpoint(
10901091
?string $username,

0 commit comments

Comments
 (0)