Re: pgAdmin IV API test cases patch - Mailing list pgadmin-hackers

From Dave Page
Subject Re: pgAdmin IV API test cases patch
Date
Msg-id CA+OCxox9NnHp+BYVr=WGBMCGeh1Qw4JE04nzqt9tvYe3XQ2grg@mail.gmail.com
Whole thread Raw
In response to Re: pgAdmin IV API test cases patch  (Priyanka Shendge <priyanka.shendge@enterprisedb.com>)
List pgadmin-hackers
Hi

On Thu, Jul 14, 2016 at 12:50 PM, Priyanka Shendge
<priyanka.shendge@enterprisedb.com> wrote:
> Hi Dave,
>
> I have added more debug statements to older patch. New patch attached.
> Also, i removed database deletion test case from current patch so that we
> can analyse
> if database is added or not.

OK. One quick note - somewhere along the way,
test_advanced_config.json has been changed back to
test_advance_config.json. The first is correct - please include that
fix in the next patch.

The database is added - assuming you're referring to one randomly
named like bbb6cad or d602036?

> I have added few more debug statements to database add test case. After
> running the testsuite
> can you please confirm whether the database is created or not under server
> node?
>
> Could you please re-run the attached patch and send me the logs and output?

Sure - all the interesting info is here:

runTest (pgadmin.browser.tests.test_login.LoginTestCase)
This function checks login functionality. (TestCase for Checking
Invalid_Password) ... ok
runTest (pgadmin.browser.tests.test_login.LoginTestCase)
This function checks login functionality. (Empty_Password) ... ok
runTest (pgadmin.browser.tests.test_login.LoginTestCase)
This function checks login functionality. (Empty_Email) ... ok
runTest (pgadmin.browser.tests.test_login.LoginTestCase)
This function checks login functionality. (Empty_Creadentials) ... ok
runTest (pgadmin.browser.tests.test_login.LoginTestCase)
This function checks login functionality. (Invalid_Email) ... ok
runTest (pgadmin.browser.tests.test_login.LoginTestCase)
This function checks login functionality. (Invalid_Creadentials) ... ok
runTest (pgadmin.browser.tests.test_login.LoginTestCase)
This function checks login functionality. (Valid_Creadentials) ... ok
runTest (pgadmin.browser.server_groups.tests.test_sg_add.SgNodeTestCase)
This function will check available server groups. (Check Server Group
Node) ... ok
runTest (pgadmin.browser.tests.test_reset_password.ResetPasswordTestCase)
This function checks reset password functionality. (TestCase for
Validating Empty Email) ... ok
runTest (pgadmin.browser.tests.test_reset_password.ResetPasswordTestCase)
This function checks reset password functionality. (TestCase for
Validating Invalid_Email) ... ok
runTest (pgadmin.browser.tests.test_reset_password.ResetPasswordTestCase)
This function checks reset password functionality. (TestCase for
Validating Valid_Email) ... ok
runTest (pgadmin.browser.tests.test_change_password.ChangePasswordTestCase)
This function will check change password functionality. (TestCase for
Validating Incorrect_New_Password) ... ok
runTest (pgadmin.browser.tests.test_change_password.ChangePasswordTestCase)
This function will check change password functionality. (TestCase for
Validating New_Password_Less_Than_Min_Length) ... ok
runTest (pgadmin.browser.tests.test_change_password.ChangePasswordTestCase)
This function will check change password functionality. (TestCase for
Validating Empty_New_Password) ... ok
runTest (pgadmin.browser.tests.test_change_password.ChangePasswordTestCase)
This function will check change password functionality. (TestCase for
Validating Incorrect_Current_Password) ... ok
runTest (pgadmin.browser.tests.test_change_password.ChangePasswordTestCase)
This function will check change password functionality. (TestCase for
Changing Valid_Password) ... ok
runTest (pgadmin.browser.tests.test_change_password.ChangePasswordTestCase)
This function will check change password functionality.
(Reassigning_Password) ... ok
runTest (pgadmin.browser.server_groups.tests.test_sg_get.SgGetTestCase)
This function will check available server groups. (Check Server Group
Node) ... ok
runTest (pgadmin.browser.server_groups.servers.tests.test_server_add.ServersAddTestCase)
This function will add the server under default server group. (Default
Server Node url) ... ('\nServer id in server add', u'9')
ok
runTest (pgadmin.browser.server_groups.servers.tests.test_server_get.ServersGetTestCase)
This function will fetch the added servers to object browser. (Default
Server Node url) ... ok
runTest (pgadmin.browser.server_groups.servers.tests.test_server_put.ServerUpdateTestCase)
This function will update the server's comment field. (Default Server
Node url) ... 2016-07-15 13:29:39,946: INFO pgadmin: Connection
Request for server#9
FAIL
runTest (pgadmin.browser.server_groups.servers.databases.tests.test_db_add.DatabaseAddTestCase)
This function will add database under 1st server of tree node. (Check
Databases Node URL) ... 2016-07-15 13:29:39,956: INFO pgadmin:
Connection Request for server#9
FAIL
runTest (pgadmin.browser.server_groups.servers.databases.tests.test_db_get.DatabasesGetTestCase)
This function will fetch added database. (Check Databases Node URL) ...

('db id in get database from pickle:', 158619)
('Database Details From pickle: id in test nodes:', 158619)
2016-07-15 13:29:39,962: INFO pgadmin: Connection Request for server#9


('Server Connection Response After Database Addition in test nodes',
u'{"info": "", "errormsg": "Server not found.", "data": null,
"result": null, "success": 0}')
2016-07-15 13:29:39,969: ERROR pgadmin: Exception on
/browser/database/connect/1/9/158619 [POST]
Traceback (most recent call last):
  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py",
line 1817, in wsgi_app
    response = self.full_dispatch_request()
  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py",
line 1477, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py",
line 1381, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py",
line 1475, in full_dispatch_request
    rv = self.dispatch_request()
  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py",
line 1461, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/views.py",
line 84, in view
    return self.dispatch_request(*args, **kwargs)
  File "/Users/dpage/git/pgadmin4/web/pgadmin/browser/utils.py", line
235, in dispatch_request
    return method(*args, **kwargs)
  File "/Users/dpage/git/pgadmin4/web/pgadmin/browser/server_groups/servers/databases/__init__.py",
line 334, in connect
    conn = manager.connection(did=did, auto_reconnect=True)
AttributeError: 'NoneType' object has no attribute 'connection'


('Database Connection Response After Database Addition in test nodes',
u'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">\n<title>500
Internal Server Error</title>\n<h1>Internal Server Error</h1>\n<p>The
server encountered an internal error and was unable to complete your
request.  Either the server is overloaded or there is an error in the
application.</p>\n')
ERROR
runTest (pgadmin.browser.server_groups.servers.databases.tests.test_db_put.DatabasesUpdateTestCase)
This function will update the comments field of database. (Check
Databases Node) ...

('db id in update database from pickle:', 158619)
('Database Details From pickle: id in test nodes:', 158619)
2016-07-15 13:29:39,976: INFO pgadmin: Connection Request for server#9


('Server Connection Response After Database Addition in test nodes',
u'{"info": "", "errormsg": "Server not found.", "data": null,
"result": null, "success": 0}')
2016-07-15 13:29:39,983: ERROR pgadmin: Exception on
/browser/database/connect/1/9/158619 [POST]
Traceback (most recent call last):
  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py",
line 1817, in wsgi_app
    response = self.full_dispatch_request()
  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py",
line 1477, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py",
line 1381, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py",
line 1475, in full_dispatch_request
    rv = self.dispatch_request()
  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py",
line 1461, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/views.py",
line 84, in view
    return self.dispatch_request(*args, **kwargs)
  File "/Users/dpage/git/pgadmin4/web/pgadmin/browser/utils.py", line
235, in dispatch_request
    return method(*args, **kwargs)
  File "/Users/dpage/git/pgadmin4/web/pgadmin/browser/server_groups/servers/databases/__init__.py",
line 334, in connect
    conn = manager.connection(did=did, auto_reconnect=True)
AttributeError: 'NoneType' object has no attribute 'connection'


('Database Connection Response After Database Addition in test nodes',
u'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">\n<title>500
Internal Server Error</title>\n<h1>Internal Server Error</h1>\n<p>The
server encountered an internal error and was unable to complete your
request.  Either the server is overloaded or there is an error in the
application.</p>\n')
ERROR
runTest (pgadmin.browser.server_groups.servers.tests.test_server_delete.ServerDeleteTestCase)
This function will get all available servers under object browser
(Default Server Node url) ... ok
runTest (pgadmin.browser.tests.test_logout.LogoutTest)
This function checks the logout functionality. (Logging Out) ... ok

======================================================================
ERROR: runTest (pgadmin.browser.server_groups.servers.databases.tests.test_db_get.DatabasesGetTestCase)
This function will fetch added database. (Check Databases Node URL)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/dpage/git/pgadmin4/web/pgadmin/browser/server_groups/servers/databases/tests/test_db_get.py",
line 38, in runTest
    db_con = test_getnodes(node=self)
  File "/Users/dpage/git/pgadmin4/web/regression/test_nodes.py", line
48, in test_getnodes
    db_con = json.loads(con_response.data.decode())
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/__init__.py",
line 338, in loads
    return _default_decoder.decode(s)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py",
line 366, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py",
line 384, in raw_decode
    raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded

======================================================================
ERROR: runTest (pgadmin.browser.server_groups.servers.databases.tests.test_db_put.DatabasesUpdateTestCase)
This function will update the comments field of database. (Check Databases Node)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/dpage/git/pgadmin4/web/pgadmin/browser/server_groups/servers/databases/tests/test_db_put.py",
line 39, in runTest
    db_con = test_getnodes(node=self)
  File "/Users/dpage/git/pgadmin4/web/regression/test_nodes.py", line
48, in test_getnodes
    db_con = json.loads(con_response.data.decode())
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/__init__.py",
line 338, in loads
    return _default_decoder.decode(s)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py",
line 366, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py",
line 384, in raw_decode
    raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded

======================================================================
FAIL: runTest (pgadmin.browser.server_groups.servers.tests.test_server_put.ServerUpdateTestCase)
This function will update the server's comment field. (Default Server Node url)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/dpage/git/pgadmin4/web/pgadmin/browser/server_groups/servers/tests/test_server_put.py",
line 64, in runTest
    self.assertTrue(respdata['success'], 1)
AssertionError: 1

======================================================================
FAIL: runTest (pgadmin.browser.server_groups.servers.databases.tests.test_db_add.DatabaseAddTestCase)
This function will add database under 1st server of tree node. (Check
Databases Node URL)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/dpage/git/pgadmin4/web/pgadmin/browser/server_groups/servers/databases/tests/test_db_add.py",
line 47, in runTest
    self.assertEquals(response.status_code, 200)
AssertionError: 400 != 200

----------------------------------------------------------------------
Ran 26 tests in 12.312s

FAILED (failures=2, errors=2)
('Please check output in file: logger.log placed at',
'/Users/dpage/git/pgadmin4/web/regression')
Traceback (most recent call last):
  File "regression/testsuite.py", line 113, in <module>
    os.remove("parent_id.pkl")
OSError: [Errno 2] No such file or directory: 'parent_id.pkl'
(pgadmin4)piranha:web dpage$

The output log doesn't seem to contain anything more useful.

--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


pgadmin-hackers by date:

Previous
From: Dave Page
Date:
Subject: Re: PATCH: To fix the issue where cast function causes freeze (pgAdmin4)
Next
From: Dave Page
Date:
Subject: Re: pgAdmin IV : Unittest modular patch