Re: pgAdmin 4 commit: Fixed cognitive complexity issues and added some more

From: Murtuza Zabuawala <murtuza(dot)zabuawala(at)enterprisedb(dot)com>
To: Akshay Joshi <akshay(dot)joshi(at)enterprisedb(dot)com>, Aditya Toshniwal <aditya(dot)toshniwal(at)enterprisedb(dot)com>
Cc: pgadmin-hackers <pgadmin-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: pgAdmin 4 commit: Fixed cognitive complexity issues and added some more
Date: 2020-08-27 09:10:55
Message-ID: CAKKotZSskEPWddCfOSWWd7TvcDnzYxC97Q4c2-dAV3Tx5gWQEQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-hackers

Hi,

RE-SQL test for the role node is failing if the timezone of DB is different.

Traceback (most recent call last):
File
"/home/murtuza/projects/PEM/web/regression/re_sql/tests/test_resql.py",
line 500, in check_re_sql
self.assertEquals(sql, resp_sql)
File "/usr/lib/python3.6/unittest/case.py", line 1321, in deprecated_func
return original_func(*args, **kwargs)
File "/usr/lib/python3.6/unittest/case.py", line 829, in assertEqual
assertion_func(first, second, msg=msg)
File "/usr/lib/python3.6/unittest/case.py", line 1203, in
assertMultiLineEqual
self.fail(self._formatMessage(msg, standardMsg))
File "/usr/lib/python3.6/unittest/case.py", line 670, in fail
raise self.failureException(msg)
AssertionError: '-- R[313 chars] \'2050-01-01 00:00:00+05:30\';\n\nGRANT
pg_si[300 chars]n\';' != '-- R[313 chars] \'2049-12-31
10:30:00-08\';\n\nGRANT pg_signa[297 chars]n\';'
-- Role: "Role2_$%{}[]()&*^!@""'`\/#"
-- DROP ROLE "Role2_$%{}[]()&*^!@""'`\/#";

CREATE ROLE "Role2_$%{}[]()&*^!@""'`\/#" WITH
NOLOGIN
SUPERUSER
INHERIT
CREATEDB
NOCREATEROLE
NOREPLICATION
CONNECTION LIMIT 100
ENCRYPTED PASSWORD 'md5cc9a2576a43b841dcacea0f65d961e41'
- VALID UNTIL '2050-01-01 00:00:00+05:30';
+ VALID UNTIL '2049-12-31 10:30:00-08';

GRANT pg_signal_backend TO "Role2_$%{}[]()&*^!@""'`\/#";
GRANT pg_monitor TO "Role2_$%{}[]()&*^!@""'`\/#" WITH ADMIN OPTION;

ALTER ROLE "Role2_$%{}[]()&*^!@""'`\/#" IN DATABASE postgres SET
application_name TO 'pg4';

COMMENT ON ROLE "Role2_$%{}[]()&*^!@""'`\/#" IS 'This is detailed
description';
Alter Role options 2 Expected SQL File:alter_role_options2.sql... FAIL
Alter Role options 3 (MSQL) ... ok
Traceback (most recent call last):
File
"/home/murtuza/projects/PEM/web/regression/re_sql/tests/test_resql.py",
line 500, in check_re_sql
self.assertEquals(sql, resp_sql)
File "/usr/lib/python3.6/unittest/case.py", line 1321, in deprecated_func
return original_func(*args, **kwargs)
File "/usr/lib/python3.6/unittest/case.py", line 829, in assertEqual
assertion_func(first, second, msg=msg)
File "/usr/lib/python3.6/unittest/case.py", line 1203, in
assertMultiLineEqual
self.fail(self._formatMessage(msg, standardMsg))
File "/usr/lib/python3.6/unittest/case.py", line 670, in fail
raise self.failureException(msg)
AssertionError: '-- R[313 chars] \'2050-01-01 00:00:00+05:30\';\n\nGRANT
pg_mo[240 chars]n\';' != '-- R[313 chars] \'2049-12-31
10:30:00-08\';\n\nGRANT pg_monit[237 chars]n\';'
-- Role: "Role2_$%{}[]()&*^!@""'`\/#"
-- DROP ROLE "Role2_$%{}[]()&*^!@""'`\/#";

CREATE ROLE "Role2_$%{}[]()&*^!@""'`\/#" WITH
NOLOGIN
SUPERUSER
INHERIT
CREATEDB
NOCREATEROLE
NOREPLICATION
CONNECTION LIMIT 100
ENCRYPTED PASSWORD 'md5cc9a2576a43b841dcacea0f65d961e41'
- VALID UNTIL '2050-01-01 00:00:00+05:30';
+ VALID UNTIL '2049-12-31 10:30:00-08';

GRANT pg_monitor TO "Role2_$%{}[]()&*^!@""'`\/#" WITH ADMIN OPTION;

ALTER ROLE "Role2_$%{}[]()&*^!@""'`\/#" IN DATABASE postgres SET
application_name TO 'pg4';

COMMENT ON ROLE "Role2_$%{}[]()&*^!@""'`\/#" IS 'This is detailed
description';
Alter Role options 3 Expected SQL File:alter_role_options3.sql... FAIL
Alter Role options 4 (MSQL) ... ok
Traceback (most recent call last):
File
"/home/murtuza/projects/PEM/web/regression/re_sql/tests/test_resql.py",
line 500, in check_re_sql
self.assertEquals(sql, resp_sql)
File "/usr/lib/python3.6/unittest/case.py", line 1321, in deprecated_func
return original_func(*args, **kwargs)
File "/usr/lib/python3.6/unittest/case.py", line 829, in assertEqual
assertion_func(first, second, msg=msg)
File "/usr/lib/python3.6/unittest/case.py", line 1203, in
assertMultiLineEqual
self.fail(self._formatMessage(msg, standardMsg))
File "/usr/lib/python3.6/unittest/case.py", line 670, in fail
raise self.failureException(msg)
AssertionError: '-- R[313 chars] \'2050-01-01 00:00:00+05:30\';\n\nGRANT
pg_mo[259 chars]n\';' != '-- R[313 chars] \'2049-12-31
10:30:00-08\';\n\nGRANT pg_monit[256 chars]n\';'
-- Role: "Role2_$%{}[]()&*^!@""'`\/#"
-- DROP ROLE "Role2_$%{}[]()&*^!@""'`\/#";

CREATE ROLE "Role2_$%{}[]()&*^!@""'`\/#" WITH
NOLOGIN
SUPERUSER
INHERIT
CREATEDB
NOCREATEROLE
NOREPLICATION
CONNECTION LIMIT 100
ENCRYPTED PASSWORD 'md5cc9a2576a43b841dcacea0f65d961e41'
- VALID UNTIL '2050-01-01 00:00:00+05:30';
+ VALID UNTIL '2049-12-31 10:30:00-08';

GRANT pg_monitor, pg_signal_backend TO "Role2_$%{}[]()&*^!@""'`\/#" WITH
ADMIN OPTION;

ALTER ROLE "Role2_$%{}[]()&*^!@""'`\/#" IN DATABASE postgres SET
application_name TO 'pg4';

COMMENT ON ROLE "Role2_$%{}[]()&*^!@""'`\/#" IS 'This is detailed
description';
Alter Role options 4 Expected SQL File:alter_role_options4.sql... FAIL

--
Regards,
Murtuza Zabuawala
*EDB*
*POWER TO POSTGRES*
https://www.edbpostgres.com

On Thu, Aug 27, 2020 at 1:10 PM Akshay Joshi <akshay(dot)joshi(at)enterprisedb(dot)com>
wrote:

> Fixed cognitive complexity issues and added some more RESQL test cases for
> roles module.
>
> Branch
> ------
> master
>
> Details
> -------
>
> https://git.postgresql.org/gitweb?p=pgadmin4.git;a=commitdiff;h=53a54103379840795fc03f5940cb53dd99ff0ee9
> Author: Aditya Toshniwal <aditya(dot)toshniwal(at)enterprisedb(dot)com>
>
> Modified Files
> --------------
> .../server_groups/servers/roles/__init__.py | 609
> +++++++++------------
> .../templates/roles/sql/9.4_plus/properties.sql | 1 +
> ..._role_options.msql => alter_role_options1.msql} | 4 +-
> .../roles/tests/9.4_plus/alter_role_options1.sql | 20 +
> .../roles/tests/9.4_plus/alter_role_options2.msql | 2 +
> .../roles/tests/9.4_plus/alter_role_options2.sql | 20 +
> .../roles/tests/9.4_plus/alter_role_options3.msql | 1 +
> ...er_role_options.sql => alter_role_options3.sql} | 4 +-
> .../roles/tests/9.4_plus/alter_role_options4.msql | 1 +
> .../roles/tests/9.4_plus/alter_role_options4.sql | 19 +
> .../servers/roles/tests/9.4_plus/test.json | 54 +-
> 11 files changed, 370 insertions(+), 365 deletions(-)
>
>

In response to

Responses

Browse pgadmin-hackers by date

  From Date Subject
Next Message Aditya Toshniwal 2020-08-27 09:12:08 Re: pgAdmin 4 commit: Fixed cognitive complexity issues and added some more
Previous Message Pramod Ahire 2020-08-27 07:53:53 Re: SCSS Minor SonarQube fixes