Skip to content

Commit b1a5caa

Browse files
committed
Fix Test Cases.
1 parent 7476ad4 commit b1a5caa

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

web/pgadmin/tools/sqleditor/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1895,11 +1895,11 @@ def set_pref_options(trans_id, operation):
18951895

18961896
if operation == 'auto_commit':
18971897
# Call the set_auto_commit method of transaction object
1898-
trans_obj.set_auto_commit(_data['auto_commit'])
1898+
trans_obj.set_auto_commit(_data)
18991899
elif operation == 'auto_rollback':
1900-
trans_obj.set_auto_rollback(_data['auto_rollback'])
1900+
trans_obj.set_auto_rollback(_data)
19011901
elif operation == 'server_cursor':
1902-
trans_obj.set_server_cursor(_data['server_cursor'])
1902+
trans_obj.set_server_cursor(_data)
19031903

19041904
# As we changed the transaction object we need to
19051905
# restore it and update the session variable.

web/pgadmin/tools/sqleditor/tests/test_server_cursor.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,7 @@ def initiate_sql_query_tool(self, trans_id, sql_query):
6464

6565
def set_server_cursor(self, server_cursor):
6666
_url = '/sqleditor/server_cursor/{0}'.format(self.trans_id)
67-
res = self.tester.post(_url, data=json.dumps({
68-
"server_cursor": server_cursor
69-
}))
70-
67+
res = self.tester.post(_url, data=json.dumps(server_cursor))
7168
self.assertEqual(res.status_code, 200)
7269

7370
def runTest(self):
@@ -93,8 +90,8 @@ def runTest(self):
9390
response = self.initiate_sql_query_tool(self.trans_id, self.sql)
9491

9592
self.assertEqual(response.status_code, 200)
96-
_resp = response.data.decode()
97-
self.assertTrue(_resp.server_cursor)
93+
_resp =json.loads(response.data.decode())
94+
self.assertTrue(_resp['data']['server_cursor'])
9895

9996
self.set_server_cursor(False)
10097

0 commit comments

Comments
 (0)