{
  "domain_constraint_create": [
    {
      "name": "Create domain: With valid data",
      "url": "/browser/domain_constraints/obj/",
      "is_positive_test": true,
      "test_data": {
        "name": "PLACE HOLDER",
        "consrc": "VALUE > 0",
        "convalidated": true
      },
      "mocking_required": false,
      "mock_data": {},
      "expected_data": {
        "status_code": 200,
        "error_msg": null,
        "test_result_data": {}
      }
    },
    {
      "name": "Create domain: With valid data - bad icon",
      "url": "/browser/domain_constraints/obj/",
      "is_positive_test": true,
      "test_data": {
        "name": "PLACE HOLDER",
        "consrc": "VALUE > 0",
        "convalidated": false
      },
      "mocking_required": false,
      "mock_data": {},
      "expected_data": {
        "status_code": 200,
        "error_msg": null,
        "test_result_data": {}
      }
    },
    {
      "name": "Error Create domain - Internal Server error 1",
      "url": "/browser/domain_constraints/obj/",
      "is_positive_test": false,
      "internal_server_error": true,
      "test_data": {
        "name": "PLACE HOLDER",
        "consrc": "VALUE > 0",
        "convalidated": true
      },
      "mocking_required": true,
      "mock_data": {
         "function_name": "pgadmin.utils.driver.psycopg2.connection.Connection.execute_scalar",
         "return_value": "(False, 'Mocked Internal Server Error')"
      },
      "expected_data": {
        "status_code": 500,
        "error_msg": null,
        "test_result_data": {}
      }
    },
    {
      "name": "Error Create domain - Internal Server error 2",
      "url": "/browser/domain_constraints/obj/",
      "is_positive_test": false,
      "error_in_db": true,
      "test_data": {
        "name": "PLACE HOLDER",
        "consrc": "VALUE > 0",
        "convalidated": true
      },
      "mocking_required": true,
      "mock_data": {
         "function_name": "pgadmin.browser.server_groups.servers.databases.schemas.domains.domain_constraints.DomainConstraintView.get_sql",
         "return_value": "(False, 'Mocked Internal Server Error','')"
      },
      "expected_data": {
        "status_code": 200
      }
    },
    {
      "name": "Error Create domain - Internal Server error- coid",
      "url": "/browser/domain_constraints/obj/",
      "is_positive_test": false,
      "error_getting_coid": true,
      "test_data": {
        "name": "PLACE HOLDER",
        "consrc": "VALUE > 0",
        "convalidated": true
      },
      "mocking_required": true,
      "mock_data": {
         "function_name": "pgadmin.utils.driver.psycopg2.connection.Connection.execute_scalar",
         "return_value": "(True, 'Mocking the scalar output'), (False, 'Mocked Internal Server Error while creating domain')"
      },
      "expected_data": {
        "status_code": 500,
        "error_msg": null,
        "test_result_data": {}
      }
    },
    {
      "name": "Error Create domain - wrong domain_id",
      "url": "/browser/domain_constraints/obj/",
      "is_positive_test": false,
      "error_domain_id": true,
      "test_data": {
        "name": "PLACE HOLDER",
        "consrc": "VALUE > 0",
        "convalidated": true
      },
      "mocking_required": false,
      "mock_data": {
      },
      "expected_data": {
        "status_code": 410
      }
    }
  ],
  "domain_constraint_delete": [
    {
      "name": "delete domain constraint",
      "url": "/browser/domain_constraints/obj/",
      "is_positive_test": true,
      "mocking_required": false,
      "mock_data": {},
      "expected_data": {
        "status_code": 200
      }
    },
    {
      "name": "Error while deleting a domain - Internal server error - 1",
      "url": "/browser/domain_constraints/obj/",
      "error_deleting_domain_constraints": true,
      "is_positive_test": false,
      "mocking_required": true,
      "mock_data": {
        "function_name": "pgadmin.utils.driver.psycopg2.connection.Connection.execute_dict",
        "return_value": "(False, 'Mocked Internal Server Error while deleting a domain')"
      },
      "expected_data": {
        "status_code": 500
      }
    },
    {
      "name": "Error while deleting a domain - Internal server error - 2",
      "url": "/browser/domain_constraints/obj/",
      "error_deleting_domain_constraints": true,
      "is_positive_test": false,
      "mocking_required": true,
      "mock_data": {
        "function_name": "pgadmin.utils.driver.psycopg2.connection.Connection.execute_scalar",
        "return_value": "(False, 'Mocked Internal Server Error while deleting a domain')"
      },
      "expected_data": {
        "status_code": 500
      }
    },
    {
      "name": "delete domain constraint using wrong domain id",
      "url": "/browser/domain_constraints/obj/",
      "wrong_domain_constraint_id": true,
      "is_positive_test": false,
      "mocking_required": false,
      "mock_data": {
      },
      "expected_data": {
        "status_code": 410
      }
    }
  ],
  "domain_constraint_multiple_delete" :[
    {
      "name": "Delete multiple domain constraint",
      "url": "/browser/domain_constraints/obj/",
      "is_positive_test": true,
      "mocking_required": false,
      "mock_data": {},
      "expected_data": {
        "status_code": 200
      }
    }
  ],
  "domain_constraint_dependent_dependency": [
    {
      "name": "Get domain constraints dependents",
      "url": "/browser/domain_constraints/dependent/",
      "is_positive_test": true,
      "mocking_required": false,
      "mock_data": {},
      "expected_data": {
        "status_code": 200
      }
    },
    {
      "name": "Get domain constraints dependencies",
      "url": "/browser/domain_constraints/dependency/",
      "is_positive_test": true,
      "mocking_required": false,
      "mock_data": {},
      "expected_data": {
        "status_code": 200
      }
    }
  ],
  "domain_constraints_get_nodes": [
    {
      "name": "Get domain constraints nodes",
      "url": "/browser/domain_constraints/nodes/",
      "is_positive_test": true,
      "invalid": false,
      "mocking_required": false,
      "mock_data": {},
      "expected_data": {
        "status_code": 200
      }
    },
    {
      "name": "Get domain constraints - not valid nodes",
      "url": "/browser/domain_constraints/nodes/",
      "is_positive_test": true,
      "invalid": true,
      "mocking_required": false,
      "mock_data": {},
      "expected_data": {
        "status_code": 200
      }
    },
    {
      "name": "Error while fetching domain constraints nodes",
      "url": "/browser/domain_constraints/nodes/",
      "error_fetching_domain_constraint": true,
      "is_positive_test": false,
      "invalid": false,
      "mocking_required": true,
      "mock_data": {
        "function_name": "pgadmin.utils.driver.psycopg2.connection.Connection.execute_2darray",
        "return_value": "(False, 'Mocked Internal Server Error while fetching a domain constraints nodes')"
      },
      "expected_data": {
        "status_code": 500
      }
    },
    {
      "name": "Get domain constraint node",
      "url": "/browser/domain_constraints/nodes/",
      "is_positive_test": true,
      "invalid": false,
      "node": true,
      "mocking_required": false,
      "mock_data": {},
      "expected_data": {
        "status_code": 200
      }
    },
    {
      "name": "Get domain constraint - not valid node",
      "url": "/browser/domain_constraints/nodes/",
      "is_positive_test": true,
      "invalid": true,
      "node": true,
      "mocking_required": false,
      "mock_data": {},
      "expected_data": {
        "status_code": 200
      }
    },
    {
      "name": "Error while fetching a domain constraint node",
      "url": "/browser/domain_constraints/nodes/",
      "error_fetching_domain_constraint": true,
      "is_positive_test": false,
      "invalid": false,
      "node": true,
      "mocking_required": true,
      "mock_data": {
        "function_name": "pgadmin.utils.driver.psycopg2.connection.Connection.execute_2darray",
        "return_value": "(False, 'Mocked Internal Server Error while fetching a domain nodes')"
      },
      "expected_data": {
        "status_code": 500
      }
    },
    {
      "name": "Error - Fetching domain constraint using wrong domain id",
      "url": "/browser/domain_constraints/nodes/",
      "wrong_domain_constraint_id": true,
      "is_positive_test": false,
      "invalid": false,
      "mocking_required": false,
      "mock_data": {
      },
      "expected_data": {
        "status_code": 410
      }
    }
  ],
  "domain_constraints_update": [
    {
      "name": "Update domain",
      "url": "/browser/domain_constraints/obj/",
      "is_positive_test": true,
      "mocking_required": false,
      "test_data": {
        "description": "This is domain constraint update comment",
        "id": "PLACE_HOLDER"
      },
      "mock_data": {},
      "expected_data": {
        "status_code": 200
      }
    },
    {
      "name": "Update domain with convalidate - true",
      "url": "/browser/domain_constraints/obj/",
      "is_positive_test": true,
      "mocking_required": false,
      "test_data": {
        "description": "This is domain constraint update comment",
        "id": "PLACE_HOLDER",
        "convalidated": true
      },
      "mock_data": {},
      "expected_data": {
        "status_code": 200
      }
    },
    {
      "name": "Update domain with convalidate - false",
      "url": "/browser/domain_constraints/obj/",
      "is_positive_test": true,
      "mocking_required": false,
      "test_data": {
        "description": "This is domain constraint update comment",
        "id": "PLACE_HOLDER",
        "convalidated": false
      },
      "mock_data": {},
      "expected_data": {
        "status_code": 200
      }
    },
    {
      "name": "Error while updating a domain constraint - Internal server error",
      "url": "/browser/domain_constraints/obj/",
      "error_in_db": true,
      "test_data": {
        "description": "This is domain update comment",
        "id": "PLACE_HOLDER"
      },
      "is_positive_test": false,
      "mocking_required": true,
      "mock_data": {
        "function_name": "pgadmin.utils.driver.psycopg2.connection.Connection.execute_scalar",
        "return_value": "[(False, 'Mocked Internal Server Error while fetching a domain')]"
      },
      "expected_data": {
        "status_code": 500
      }
    },
    {
      "name": "Error while updating a domain constraint - Internal server error -SQL",
      "url": "/browser/domain_constraints/obj/",
      "error_in_db": true,
      "test_data": {
        "description": "This is domain update comment",
        "id": "PLACE_HOLDER"
      },
      "is_positive_test": false,
      "mocking_required": true,
      "mock_data": {
        "function_name": "pgadmin.browser.server_groups.servers.databases.schemas.domains.domain_constraints.DomainConstraintView.get_sql",
        "return_value": "[(False, 'Mocked SQL statement', '')]"
      },
      "expected_data": {
        "status_code": 200
      }
    },
    {
      "name": "Error while updating a domain constraint - Update not required",
      "url": "/browser/domain_constraints/obj/",
      "error_in_db": true,
      "test_data": {
        "description": "This is domain update comment",
        "id": "PLACE_HOLDER"
      },
      "is_positive_test": false,
      "mocking_required": true,
      "mock_data": {
        "function_name": "pgadmin.browser.server_groups.servers.databases.schemas.domains.domain_constraints.DomainConstraintView.get_sql",
        "return_value": "[(True, '', '')]"
      },
      "expected_data": {
        "status_code": 200
      }
    }
  ],
  "domain_constraints_get_sql": [
    {
      "name": "Get Domain Constraint SQL",
      "url": "/browser/domain_constraints/sql/",
      "is_positive_test": true,
      "mocking_required": false,
      "mock_data": {},
      "expected_data": {
        "status_code": 200
      }
    },
    {
      "name": "Error - Get Domain Constraint SQL - Internal server error",
      "url": "/browser/domain_constraints/sql/",
      "is_positive_test": false,
      "internal_server_error": true,
      "mocking_required": true,
      "mock_data": {
        "function_name": "pgadmin.utils.driver.psycopg2.connection.Connection.execute_dict",
        "return_value": "(False, 'Mocked Internal Server Error while fetching a domain')"
      },
      "expected_data": {
        "status_code": 500
      }
    },
    {
      "name": "Error - Get Domain Constraint SQL using wrong domain id",
      "url": "/browser/domain_constraints/sql/",
      "wrong_domain_constraint_id": true,
      "is_positive_test": false,
      "mocking_required": false,
      "mock_data": {
      },
      "expected_data": {
        "status_code": 410
      }
    }
  ],
  "domain_constraints_get_msql": [
    {
      "name": "Get domain constraint msql",
      "is_positive_test": true,
       "url": "/browser/domain_constraints/msql/",
      "test_data": {
        "name": "modifying name",
        "comment": "Comments to test update"
      },
      "mocking_required": true,
      "mock_data": {},
      "expected_data": {
        "status_code": 200
      }
    },
    {
      "name": "Get domain constraint msql: With existing domain constraint id 1.",
      "is_positive_test": false,
      "error_in_db": true,
       "url": "/browser/domain_constraints/msql/",
      "test_data": {
        "name": "modifying name",
        "comment": "Comments to test update"
      },
      "mocking_required": true,
      "mock_data": {
         "function_name": "pgadmin.browser.server_groups.servers.databases.schemas.domains.domain_constraints.DomainConstraintView.get_sql",
         "return_value": "('', 'Mocked get_sql function', '')"
      },
      "expected_data": {
        "status_code": 200
      }
    },
    {
      "name": "Get domain constraint msql: With existing domain constraint id 2.",
      "is_positive_test": false,
      "error_in_db": true,
       "url": "/browser/domain_constraints/msql/",
      "test_data": {
        "name": "modifying name",
        "comment": "Comments to test update"
      },
      "mocking_required": true,
      "mock_data": {
         "function_name": "pgadmin.browser.server_groups.servers.databases.schemas.domains.domain_constraints.DomainConstraintView.get_sql",
         "return_value": "('True', 'Mocked get_sql function', '')"
      },
      "expected_data": {
        "status_code": 200
      }
    }
  ],
  "domain_constraints_get": [
    {
      "name": "Get domain constraints",
      "url": "/browser/domain_constraints/obj/",
      "is_positive_test": true,
      "mocking_required": false,
      "mock_data": {},
      "expected_data": {
        "status_code": 200
      }
    },
    {
      "name": "Error while fetching a domain constraints",
      "url": "/browser/domain_constraints/obj/",
      "error_fetching_domain_constraints": true,
      "is_positive_test": false,
      "mocking_required": true,
      "mock_data": {
        "function_name": "pgadmin.utils.driver.psycopg2.connection.Connection.execute_dict",
        "return_value": "(False, 'Mocked Internal Server Error while fetching a domain')"
      },
      "expected_data": {
        "status_code": 500
      }
    },
    {
      "name": "Error - Fetching domain constarint with wrong ID",
      "url": "/browser/domain_constraints/obj/",
      "wrong_domain_cons_id": true,
      "is_positive_test": false,
      "mocking_required": true,
      "mock_data": {},
      "expected_data": {
        "status_code": 410
      }
    },
    {
      "name": "Get domain constraints list",
      "url": "/browser/domain_constraints/obj/",
      "is_positive_test": true,
      "domain_constraint_list": true,
      "mocking_required": false,
      "mock_data": {},
      "expected_data": {
        "status_code": 200
      }
    },
    {
      "name": "Error while fetching a domain constraint list",
      "url": "/browser/domain_constraints/obj/",
      "error_fetching_domain_constraints": true,
      "is_positive_test": false,
      "domain_constraint_list": true,
      "mocking_required": true,
      "mock_data": {
        "function_name": "pgadmin.utils.driver.psycopg2.connection.Connection.execute_dict",
        "return_value": "(False, 'Mocked Internal Server Error while fetching a domain constraint')"
      },
      "expected_data": {
        "status_code": 500
      }
    }
  ]
}
