diff --git a/features/backend/projects/database_connections/main_tests_database_connections_mysql.feature b/features/backend/projects/database_connections/main_tests_database_connections_mysql.feature index afacfd8ed..d4a7427c6 100644 --- a/features/backend/projects/database_connections/main_tests_database_connections_mysql.feature +++ b/features/backend/projects/database_connections/main_tests_database_connections_mysql.feature @@ -9,8 +9,8 @@ Feature: DataBase Connections Main Tests Mysql Given that I have a valid access_token - # GET /api/1.0/{workspace}/project//database-connections - # Get list DataBase Connections +# GET /api/1.0/{workspace}/project//database-connections + # Get list DataBase| dbs_type | dbs_server | dbs_database_name | dbs_username | dbs_password | dbs_port | dbs_encode | dbs_description | Connections Scenario Outline: Get the DataBase Connections List when there are exactly zero DataBase Connections Given I request "project//database-connections" Then the response status code should be 200 @@ -18,10 +18,9 @@ Feature: DataBase Connections Main Tests Mysql And the response has record Examples: - - | project | record | - | 74737540052e1641ab88249082085472 | 1 | - | 87648819953a85c0abc01d3080475981 | 1 | + | project | record | + | 106912358530c9b14ac15d3001790900 | 0 | + | 1265557095225ff5c688f46031700471 | 0 | # POST /api/1.0/{workspace}/project//database-connection/test @@ -41,12 +40,141 @@ Feature: DataBase Connections Main Tests Mysql } """ And I request "project//database-connection/test" - Then database-connection with id "" is active + Then if database-connection with id "" is active Then the response status code should be 200 And the response charset is "UTF-8" And the content type is "application/json" Examples: | dbs_uid_number | project | dbs_type | dbs_server | dbs_database_name | dbs_username | dbs_password | dbs_port | dbs_encode | dbs_description | - | 46110938554821d2ddb8d01076533986 | 74737540052e1641ab88249082085472 | | | | | | | | | - | 40639901154821d2e3bb7e8061116901 | 87648819953a85c0abc01d3080475981 | | | | | | | | | \ No newline at end of file + | 1 | 106912358530c9b14ac15d3001790900 | | | | | | | | | + | 2 | 1265557095225ff5c688f46031700471 | | | | | | | | | + + + # POST /api/1.0/{workspace}/project//database-connection + # Create new DataBase Connection + Scenario Outline: Create a new database connection + Given database-connection with id "" is active + And POST this data: + """ + { + "dbs_type": "", + "dbs_server": "", + "dbs_database_name": "", + "dbs_username": "", + "dbs_password": "", + "dbs_port": , + "dbs_encode": "", + "dbs_description": "" + } + """ + And I request "project//database-connection" + Then the response status code should be 201 + And the response charset is "UTF-8" + And the content type is "application/json" + And the type is "object" + And store "dbs_uid" in session array as variable "dbs_uid_" + + Examples: + | dbs_uid_number | project | dbs_type | dbs_server | dbs_database_name | dbs_username | dbs_password | dbs_port | dbs_encode | dbs_description | + | 1 | 106912358530c9b14ac15d3001790900 | | | | | | | | | + | 2 | 1265557095225ff5c688f46031700471 | | | | | | | | | + + + # GET /api/1.0/{workspace}/project//database-connection + # Get DataBase Connections list of each process + Scenario Outline: Get the DataBase Connections List when there are exactly one DataBase Connections in each process + Given database-connection with id "" is active + And I request "project//database-connections" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the response has record + + Examples: + | project | record | dbs_uid_number | + | 106912358530c9b14ac15d3001790900 | 1 | 1 | + | 1265557095225ff5c688f46031700471 | 1 | 2 | + + + # PUT /api/1.0/{workspace}/project//database-connection + # Update a DataBase Connection + Scenario Outline: Update a database connection + Given database-connection with id "" is active + And PUT this data: + """ + { + "dbs_type": "", + "dbs_server": "", + "dbs_database_name": "", + "dbs_username": "", + "dbs_password": "", + "dbs_port": , + "dbs_encode": "", + "dbs_description": "" + } + """ + And that I want to update a resource with the key "dbs_uid" stored in session array as variable "dbs_uid_" + And I request "project//database-connection" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the type is "object" + + Examples: + | dbs_uid_number | project | dbs_type | dbs_server | dbs_database_name | dbs_username | dbs_password | dbs_port | dbs_encode | dbs_description | + | 1 | 106912358530c9b14ac15d3001790900 | | | | | | | | | + | 2 | 1265557095225ff5c688f46031700471 | | | | | | | | | + + + # GET /api/1.0/{workspace}/project//database-connection + # Get a single DataBase Connection and their properties + Scenario Outline: Get a single database connection and check some properties + Given database-connection with id "" is active + And that I want to get a resource with the key "dbs_uid" stored in session array as variable "dbs_uid_" + And I request "project//database-connection" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the type is "object" + And that "dbs_type" is set to "" + And that "dbs_server" is set to "" + And that "dbs_database_name" is set to "" + And that "dbs_username" is set to "" + And that "dbs_password" is set to "" + And that "dbs_port" is set to "" + And that "dbs_encode" is set to "" + And that "dbs_description" is set to "" + + Examples: + | dbs_uid_number | project | dbs_type | dbs_server | dbs_database_name | dbs_username | dbs_password | dbs_port | dbs_encode | dbs_description | + | 1 | 106912358530c9b14ac15d3001790900 | | | | | | | | | + | 2 | 1265557095225ff5c688f46031700471 | | | | | | | | | + + + # DELETE /api/1.0/{workspace}/project//database-connection + # Delete all DataBase Connections created in this script + Scenario Outline: Delete all Database Connection created in this script + Given database-connection with id "" is active + And that I want to delete a resource with the key "dbs_uid" stored in session array as variable "dbs_uid_" + And I request "project//database-connection" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the type is "object" + + Examples: + | project | dbs_uid_number | + | 106912358530c9b14ac15d3001790900 | 1 | + | 1265557095225ff5c688f46031700471 | 2 | + + + # GET /api/1.0/{workspace}/project//database-connection + # Get DataBase Connections list + Scenario Outline: Get the DataBase Connections List when there are exactly zero DataBase Connections + Given database-connection with id "" is active + And I request "project//database-connections" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the response has record + + Examples: + | project | record | dbs_uid_number | + | 106912358530c9b14ac15d3001790900 | 0 | 1 | + | 1265557095225ff5c688f46031700471 | 0 | 2 | \ No newline at end of file diff --git a/features/bootstrap/RestContext.php b/features/bootstrap/RestContext.php index 27abb39cc..3dd903424 100644 --- a/features/bootstrap/RestContext.php +++ b/features/bootstrap/RestContext.php @@ -1847,11 +1847,11 @@ class RestContext extends BehatContext */ public function databaseConnectionWithIdIsActive($dbConnectionId) { - /* if (file_exists("session.data")) { + if (file_exists("session.data")) { $sessionData = json_decode(file_get_contents("session.data")); } else { $sessionData = new StdClass(); - }*/ + } $sessionData = new StdClass(); if(!$sessionData->dbconnectionStatus->$dbConnectionId){