{
  "add_policy": [
    {
      "name": "Add policy Node",
      "url": "/browser/row_security_policy/obj/",
      "is_positive_test": true,
      "test_data": {
        "name": "PLACE_HOLDER",
        "event": "INSERT"
      },
      "mocking_required": false,
      "mock_data": {},
      "expected_data": {
        "status_code": 200
      }
    },
    {
      "name": "Add owner specific policy",
      "url": "/browser/row_security_policy/obj/",
      "is_positive_test": true,
      "owner_policy": true,
      "test_data": {
        "name": "PLACE_HOLDER",
        "policyowner": "PLACE_HOLDER",
        "event": "SELECT"
      },
      "mocking_required": false,
      "mock_data": {},
      "expected_data": {
        "status_code": 200
      }
    },
    {
      "name": "Error while adding a policy using wrong table",
      "url": "/browser/row_security_policy/obj/",
      "is_positive_test": false,
      "wrong_table_id": true,
      "test_data": {
        "name": "PLACE_HOLDER",
        "event": "Update"
      },
      "mocking_required": false,
      "mock_data": {},
      "expected_data": {
        "status_code": 410
      }
    },
    {
      "name": "Error while adding a policy",
      "url": "/browser/row_security_policy/obj/",
      "is_positive_test": false,
      "error_creating_policy": true,
      "test_data": {
        "name": "PLACE_HOLDER"
      },
      "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
      }
    },
    {
      "name": "Error while while fetching the policy id using policy name",
      "url": "/browser/row_security_policy/obj/",
      "is_positive_test": false,
      "internal_server_error": true,
      "test_data": {
        "name": "PLACE_HOLDER"
      },
      "mocking_required": true,
      "mock_data": {
        "function_name": "pgadmin.utils.driver.psycopg2.connection.Connection.execute_scalar",
        "return_value": "(True, True),(False, 'Mocked Internal Server Error ')"
      },
      "expected_data": {
        "status_code": 500
      }
    },
    {
      "name": "Exception while adding a policy",
      "url": "/browser/row_security_policy/obj/",
      "is_positive_test": false,
      "test_data": {
        "name": "PLACE_HOLDER"
      },
      "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
      }
    }
  ],
  "get_policy": [
    {
      "name": "Get a policy URL",
      "url": "/browser/row_security_policy/obj/",
      "is_positive_test": true,
      "mocking_required": false,
      "mock_data": {},
      "expected_data": {
        "status_code": 200
      }
    },
    {
      "name": "Get a policy URL using wrong policy id",
      "url": "/browser/row_security_policy/obj/",
      "is_positive_test": true,
      "incorrect_policy_id": true,
      "mocking_required": false,
      "mock_data": {},
      "expected_data": {
        "status_code": 410
      }
    },
    {
      "name": "Error while fetching a policy properties",
      "url": "/browser/row_security_policy/obj/",
      "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')"
      },
      "expected_data": {
        "status_code": 500
      }
    },
    {
      "name": "Get a policies properties under table nodes",
      "url": "/browser/row_security_policy/obj/",
      "is_positive_test": true,
      "table_nodes": true,
      "mocking_required": false,
      "mock_data": {},
      "expected_data": {
        "status_code": 200
      }
    },
    {
      "name": "Error while fetching a policies properties under table nodes",
      "url": "/browser/row_security_policy/obj/",
      "is_positive_test": false,
      "table_nodes": true,
      "mocking_required": true,
      "mock_data": {
        "function_name": "pgadmin.utils.driver.psycopg2.connection.Connection.execute_dict",
        "return_value": "(False, 'Mocked Internal Server Error')"
      },
      "expected_data": {
        "status_code": 500
      }
    },
    {
      "name": "Get a policy Node",
      "url": "/browser/row_security_policy/nodes/",
      "is_positive_test": true,
      "mocking_required": false,
      "mock_data": {},
      "expected_data": {
        "status_code": 200
      }
    },
    {
      "name": "Get a policy Node using wrong policy id",
      "url": "/browser/row_security_policy/nodes/",
      "is_positive_test": true,
      "incorrect_policy_id": true,
      "mocking_required": false,
      "mock_data": {},
      "expected_data": {
        "status_code": 410
      }
    },
    {
      "name": "Get a policy Node dependants",
      "url": "/browser/row_security_policy/dependent/",
      "is_positive_test": true,
      "mocking_required": false,
      "mock_data": {},
      "expected_data": {
        "status_code": 200
      }
    },
    {
      "name": "Get a policy Node dependency",
      "url": "/browser/row_security_policy/dependency/",
      "is_positive_test": true,
      "mocking_required": false,
      "mock_data": {},
      "expected_data": {
        "status_code": 200
      }
    },
    {
      "name": "Error while fetching the policies under the table nodes using wrong table id",
      "url": "/browser/row_security_policy/nodes/",
      "is_positive_test": false,
      "mocking_required": true,
      "mock_data": {
        "function_name": "pgadmin.utils.driver.psycopg2.connection.Connection.execute_2darray",
        "return_value": "(False, 'Mocked Internal Server Error')"
      },
      "expected_data": {
        "status_code": 500
      }
    },
    {
      "name": "Get all the policies under the table nodes",
      "url": "/browser/row_security_policy/nodes/",
      "is_positive_test": true,
      "mocking_required": false,
      "table_nodes": true,
      "mock_data": {},
      "expected_data": {
        "status_code": 200
      }
    },
    {
      "name": "Get all the policies under the table nodes using wrong table id",
      "url": "/browser/row_security_policy/nodes/",
      "is_positive_test": true,
      "incorrect_table_id": true,
      "table_nodes": true,
      "mocking_required": false,
      "mock_data": {},
      "expected_data": {
        "status_code": 200
      }
    },
    {
      "name": "Error while fetching all the policies under the table nodes using wrong table id",
      "url": "/browser/row_security_policy/nodes/",
      "is_positive_test": false,
      "table_nodes": true,
      "mocking_required": true,
      "mock_data": {
        "function_name": "pgadmin.utils.driver.psycopg2.connection.Connection.execute_2darray",
        "return_value": "(False, 'Mocked Internal Server Error')"
      },
      "expected_data": {
        "status_code": 500
      }
    },
    {
      "name": "Error while fetching a policy SQL",
      "url": "/browser/row_security_policy/sql/",
      "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')"
      },
      "expected_data": {
        "status_code": 500
      }
    },
    {
      "name": "Get a policy SQL using wrong policy id",
      "url": "/browser/row_security_policy/sql/",
      "is_positive_test": true,
      "incorrect_policy_id": true,
      "mocking_required": false,
      "mock_data": {},
      "expected_data": {
        "status_code": 410
      }
    },
    {
      "name": "Fetch msql of policy using wrong policy id",
      "url": "/browser/row_security_policy/msql/",
      "is_positive_test": false,
      "mocking_required": true,
      "mock_data": {
        "function_name": "pgadmin.browser.server_groups.servers.databases.schemas.tables.row_security_policies.utils.get_sql",
        "return_value": "('', 'Mocked response')"
      },
      "expected_data": {
        "status_code": 200
      }
    }
  ],
  "delete_policy": [
    {
      "name": "Delete a policy URL",
      "url": "/browser/row_security_policy/obj/",
      "is_positive_test": true,
      "mocking_required": false,
      "mock_data": {},
      "expected_data": {
        "status_code": 200
      }
    },
    {
      "name": "Error while fetching a policy to delete",
      "url": "/browser/row_security_policy/obj/",
      "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')"
      },
      "expected_data": {
        "status_code": 500
      }
    },
    {
      "name": "Error while deleting the policy",
      "url": "/browser/row_security_policy/obj/",
      "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')"
      },
      "expected_data": {
        "status_code": 500
      }
    },
    {
      "name": "Error while fetching a policy to delete",
      "url": "/browser/row_security_policy/obj/",
      "is_positive_test": false,
      "mocking_required": true,
      "mock_data": {
        "function_name": "pgadmin.utils.driver.psycopg2.connection.Connection.execute_dict",
        "return_value": "(True, 'Mocked Internal Server Error')"
      },
      "expected_data": {
        "status_code": 500
      }
    },
    {
      "name": "policy not found while deleting a policy",
      "url": "/browser/row_security_policy/obj/",
      "is_positive_test": true,
      "invalid_policy_id": true,
      "mocking_required": false,
      "mock_data": {},
      "expected_data": {
        "status_code": 410
      }
    }
  ],
  "update_policy": [
    {
      "name": "update a policy name",
      "url": "/browser/row_security_policy/obj/",
      "is_positive_test": true,
      "test_data": {
        "name": "PLACE_HOLDER",
        "id": "PLACE_HOLDER"
      },
      "mocking_required": false,
      "mock_data": {},
      "expected_data": {
        "status_code": 200
      }
    },
    {
      "name": "update a policy owner",
      "url": "/browser/row_security_policy/obj/",
      "is_positive_test": true,
      "owner_policy": true,
      "test_data": {
        "name": "PLACE_HOLDER",
        "id": "PLACE_HOLDER",
        "policyowner": "PLACEHOLDER"
      },
      "mocking_required": false,
      "mock_data": {},
      "expected_data": {
        "status_code": 200
      }
    },

    {
      "name": "update a policy using clause",
      "url": "/browser/row_security_policy/obj/",
      "is_positive_test": true,
      "test_data": {
        "name": "PLACE_HOLDER",
        "id": "PLACE_HOLDER",
        "using": true
      },
      "mocking_required": false,
      "mock_data": {},
      "expected_data": {
        "status_code": 200
      }
    },

    {
      "name": "update a policy with check clause",
      "url": "/browser/row_security_policy/obj/",
      "is_positive_test": true,
      "test_data": {
        "name": "PLACE_HOLDER",
        "id": "PLACE_HOLDER",
        "withcheck": true
      },
      "mocking_required": false,
      "mock_data": {},
      "expected_data": {
        "status_code": 200
      }
    },

    {
      "name": "Error while fetching a policy to update",
      "url": "/browser/row_security_policy/obj/",
      "is_positive_test": false,
      "mocking_required": true,
      "test_data": {
        "name": "PLACE_HOLDER",
        "id": "PLACE_HOLDER"
      },
      "mock_data": {
        "function_name": "pgadmin.utils.driver.psycopg2.connection.Connection.execute_dict",
        "return_value": "(False, 'Mocked Internal Server Error')"
      },
      "expected_data": {
        "status_code": 500
      }
    },
    {
      "name": "Error while updating the policy",
      "url": "/browser/row_security_policy/obj/",
      "is_positive_test": false,
      "mocking_required": true,
      "test_data": {
        "name": "PLACE_HOLDER",
        "id": "PLACE_HOLDER"
      },
      "mock_data": {
        "function_name": "pgadmin.utils.driver.psycopg2.connection.Connection.execute_scalar",
        "return_value": "(False, 'Mocked Internal Server Error')"
      },
      "expected_data": {
        "status_code": 500
      }
    },
    {
      "name": "Error while fetching a policy to update using wrong policy id",
      "url": "/browser/row_security_policy/obj/",
      "is_positive_test": true,
      "wrong_policy_id": true,
      "mocking_required": false,
      "test_data": {
        "name": "PLACE_HOLDER",
        "id": "PLACE_HOLDER"
      },
      "mock_data": {},
      "expected_data": {
        "status_code": 500
      }
    },
    {
      "name": "Error while updating the policy",
      "url": "/browser/row_security_policy/obj/",
      "is_positive_test": false,
      "mocking_required": true,
      "test_data": {
        "name": "PLACE_HOLDER",
        "id": "PLACE_HOLDER"
      },
      "mock_data": {
        "function_name": "pgadmin.browser.server_groups.servers.databases.schemas.tables.row_security_policies.utils.get_sql",
        "return_value": "('')"
      },
      "expected_data": {
        "status_code": 500
      }
    }
  ],
  "delete_multiple_policy": [
    {
      "name": "Delete multiple policy",
      "url": "/browser/row_security_policy/obj/",
      "is_positive_test": true,
      "mocking_required": false,
      "mock_data": {},
      "expected_data": {
        "status_code": 200
      }
    }
  ]
}
