public inbox for [email protected]
help / color / mirror / Atom feedFrom: Shubham Agarwal <[email protected]>
To: pgadmin-hackers <[email protected]>
Subject: RE-SQL tests patch for FTS parsers node
Date: Mon, 15 Jul 2019 16:12:35 +0530
Message-ID: <CAKbCA9TAZb+zS78yt=NU0W3oyd7btbE5yiE4M1vq=AcNY6=qqA@mail.gmail.com> (raw)
Hi Team,
PFA patch for RE-SQL tests cases for FTS parsers node.
--
Thanks & Regards,
Shubham Agarwal
EnterpriseDB Corporation
The Postgres Database Company
Attachments:
[application/octet-stream] resql_fts_parser.patch (4.3K, 3-resql_fts_parser.patch)
download | inline diff:
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_parsers/tests/default/alter_fts_parser.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_parsers/tests/default/alter_fts_parser.sql
new file mode 100644
index 00000000..a2527802
--- /dev/null
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_parsers/tests/default/alter_fts_parser.sql
@@ -0,0 +1,13 @@
+-- Text Search Parser: public."test_fts_parser_updated_$%{}[]()&*^!@""'`\/#"
+
+-- DROP TEXT SEARCH PARSER public."test_fts_parser_updated_$%{}[]()&*^!@""'`\/#"
+
+CREATE TEXT SEARCH PARSER public."test_fts_parser_updated_$%{}[]()&*^!@""'`\/#" (
+ START = prsd_start,
+ GETTOKEN = prsd_nexttoken,
+ END = void_recv,
+ LEXTYPES = dispell_init,
+ HEADLINE = prsd_headline
+);
+
+COMMENT ON TEXT SEARCH PARSER public."test_fts_parser_updated_$%{}[]()&*^!@""'`\/#" IS 'Updating test fts parser';
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_parsers/tests/default/create_fts_parser.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_parsers/tests/default/create_fts_parser.sql
new file mode 100644
index 00000000..47c6f6e9
--- /dev/null
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_parsers/tests/default/create_fts_parser.sql
@@ -0,0 +1,13 @@
+-- Text Search Parser: public."test_fts_parser_$%{}[]()&*^!@""'`\/#"
+
+-- DROP TEXT SEARCH PARSER public."test_fts_parser_$%{}[]()&*^!@""'`\/#"
+
+CREATE TEXT SEARCH PARSER public."test_fts_parser_$%{}[]()&*^!@""'`\/#" (
+ START = prsd_start,
+ GETTOKEN = prsd_nexttoken,
+ END = void_recv,
+ LEXTYPES = dispell_init,
+ HEADLINE = prsd_headline
+);
+
+COMMENT ON TEXT SEARCH PARSER public."test_fts_parser_$%{}[]()&*^!@""'`\/#" IS 'Creating test fts parser';
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_parsers/tests/default/test.json b/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_parsers/tests/default/test.json
new file mode 100644
index 00000000..4cce6846
--- /dev/null
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_parsers/tests/default/test.json
@@ -0,0 +1,40 @@
+{
+ "scenarios": [
+ {
+ "type": "create",
+ "name": "Create FTS parser",
+ "endpoint": "NODE-fts_parser.obj",
+ "sql_endpoint": "NODE-fts_parser.sql_id",
+ "data": {
+ "name": "test_fts_parser_$%{}[]()&*^!@\"'`\\/#",
+ "description": "Creating test fts parser",
+ "schema": "public",
+ "schema_id": "<SCHEMA_ID>",
+ "prsstart": "prsd_start",
+ "prstoken": "prsd_nexttoken",
+ "prsend": "void_recv",
+ "prslextype": "dispell_init",
+ "prsheadline": "prsd_headline"
+ },
+ "expected_sql_file": "create_fts_parser.sql"
+ },
+ {
+ "type": "alter",
+ "name": "Alter FTS parser",
+ "endpoint": "NODE-fts_parser.obj_id",
+ "sql_endpoint": "NODE-fts_parser.sql_id",
+ "data":{
+ "name": "test_fts_parser_updated_$%{}[]()&*^!@\"'`\\/#",
+ "description":"Updating test fts parser"},
+ "expected_sql_file": "alter_fts_parser.sql"
+ },
+ {
+ "type": "delete",
+ "name": "Drop FTS Parser",
+ "endpoint": "NODE-fts_parser.delete_id",
+ "data": {
+ "name": "test_fts_configuration_def2"
+ }
+ }
+ ]
+}
diff --git a/web/regression/re_sql/tests/test_resql.py b/web/regression/re_sql/tests/test_resql.py
index 6b87f030..e3490598 100644
--- a/web/regression/re_sql/tests/test_resql.py
+++ b/web/regression/re_sql/tests/test_resql.py
@@ -329,9 +329,15 @@ class ReverseEngineeredSQLTestCases(BaseTestGenerator):
self.final_test_status = False
print(scenario['name'] + "... FAIL")
traceback.print_exc()
-
- resp = json.loads(response.data)
- resp_sql = resp['data']
+ try:
+ if type(response.data) == bytes:
+ response_data = response.data.decode('utf8')
+ resp = json.loads(response_data)
+ else:
+ resp = json.loads(response.data)
+ resp_sql = resp['data']
+ except Exception:
+ print("Unable to decode the reponse data from url: ", url)
# Remove first and last double quotes
if resp_sql.startswith('"') and resp_sql.endswith('"'):
view thread (4+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected]
Subject: Re: RE-SQL tests patch for FTS parsers node
In-Reply-To: <CAKbCA9TAZb+zS78yt=NU0W3oyd7btbE5yiE4M1vq=AcNY6=qqA@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox