Re: [pgadmin-hackers] [pgAdmin4][Patch]: Feature test for PG Data-types in Query Tool

2017-05-25 Thread Khushboo Vashi
Hi,

Please find the attached updated patch.

Thanks,
Khushboo

On Thu, May 11, 2017 at 2:41 PM, Dave Page  wrote:

> Hi
>
> On Thu, May 11, 2017 at 6:38 AM, Khushboo Vashi <
> khushboo.va...@enterprisedb.com> wrote:
>
>> Hi,
>>
>> As we have been facing many issues with different data-type display in
>> Query Tool output, Dave suggested to write the feature test for the same.
>>
>> I have started with some basic set of data-type values and will add more.
>> Please find the attached initial patch for the same.
>>
>
> Some thoughts:
>
> - Instead of sleeping, which is almost always a bad design, can we wait
> for objects to appear?
>
> Fixed

> - Currently you're testing each datatype with an individual query, e.g.
>
> SELECT 32768;
>
> I would suggest we test all datatypes at once, e.g.
>
> SELECT 32768, 43723489023489, '2017-09-12 15:34:11', 12345.56;
>
> etc. That will massively reduce the time taken to execute the tests (which
> is a big concern).
>
> Fixed

> - Shouldn't we be casting the values in the SELECT, so we (and the
> database) know exactly what we're expecting? e.g.
>
> Fixed

> SELECT 32768::int, 43723489023489::bigint, '2017-09-12
> 15:34:11':timestamp, 12345.56::numeric(8,4);
>
> That would also allow us to verify the type name displayed in the column
> headers.
>
> Thanks!
>
> --
> Dave Page
> Blog: http://pgsnake.blogspot.com
> Twitter: @pgsnake
>
> EnterpriseDB UK: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>
diff --git a/web/pgadmin/feature_tests/pg_datatype_validation_test.py b/web/pgadmin/feature_tests/pg_datatype_validation_test.py
new file mode 100644
index 000..343ed2b
--- /dev/null
+++ b/web/pgadmin/feature_tests/pg_datatype_validation_test.py
@@ -0,0 +1,135 @@
+##
+#
+# pgAdmin 4 - PostgreSQL Tools
+#
+# Copyright (C) 2013 - 2017, The pgAdmin Development Team
+# This software is released under the PostgreSQL Licence
+#
+##
+
+from selenium.webdriver import ActionChains
+from selenium.common.exceptions import TimeoutException
+from selenium.webdriver.support.ui import WebDriverWait
+from selenium.webdriver.support import expected_conditions as EC
+from selenium.webdriver.common.by import By
+from regression.python_test_utils import test_utils
+from regression.feature_utils.base_feature_test import BaseFeatureTest
+
+
+class PGDataypeFeatureTest(BaseFeatureTest):
+"""
+This feature test will test the different Postgres
+data-type output.
+"""
+
+scenarios = [
+("Test checks for PG data-types output", dict())
+]
+
+def before(self):
+connection = test_utils.get_db_connection(self.server['db'],
+  self.server['username'],
+  self.server['db_password'],
+  self.server['host'],
+  self.server['port'])
+test_utils.drop_database(connection, "acceptance_test_db")
+test_utils.create_database(self.server, "acceptance_test_db")
+
+def runTest(self):
+self.page.wait_for_spinner_to_disappear()
+self._connects_to_server()
+self._schema_node_expandable()
+
+# Check data types
+self._check_datatype()
+self._close_query_tool()
+
+def after(self):
+self.page.remove_server(self.server)
+connection = test_utils.get_db_connection(self.server['db'],
+  self.server['username'],
+  self.server['db_password'],
+  self.server['host'],
+  self.server['port'])
+test_utils.drop_database(connection, "acceptance_test_db")
+
+def _connects_to_server(self):
+self.page.find_by_xpath("//*[@class='aciTreeText' and .='Servers']").click()
+self.page.driver.find_element_by_link_text("Object").click()
+ActionChains(self.page.driver) \
+.move_to_element(self.page.driver.find_element_by_link_text("Create")) \
+.perform()
+self.page.find_by_partial_link_text("Server...").click()
+
+server_config = self.server
+self.page.fill_input_by_field_name("name", server_config['name'])
+self.page.find_by_partial_link_text("Connection").click()
+self.page.fill_input_by_field_name("host", server_config['host'])
+self.page.fill_input_by_field_name("port", server_config['port'])
+self.page.fill_input_by_field_name("username", server_config['username'])
+self.page.fill_input_by_field_name("password", server_config['db_password'])
+self.page.find_by_xpath("//button[contains(.,'Save')]").click()
+
+def _schema_node_expandable(

[pgadmin-hackers] [pgAdmin4] [PATCH] To fix error in SQL panel

2017-05-25 Thread Murtuza Zabuawala
Hi,

PFA patch to fix the issue which due to python side validations, at many
places it was assumed that we will always get a row from query result.
RM#2427

*Note:* Almost all the database level nodes are affected by this patch.

--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


RM_2427.patch
Description: Binary data

-- 
Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers


Re: [pgadmin-hackers] [pgAdmin4][Patch][RM_2400]: Columns with defaults set to NULL when removing contents after pasting in the edit grid

2017-05-25 Thread Surinder Kumar
Hi

Please find attached patch for Feature test cases.

The approach is to create a single table 'defaults' with columns of various
types(number, text, json and boolean) and write test cases for these cell
types with different input values.

Following are the test cases covered:

1) Add a new row, save and compare the resulted value with expected values

2) Copy/Paste row, save and compare cell data

a) Clear cell value and escape, the cell must set to [default]

3) Update cell:

   a) Insert two single quotes(''), expected value is blank string

   b) Clear a cell, expected value is [null]

   c) Insert a string \’\’, expected value is ''

   d) Insert a string \\’\\’, expected value is \’\’

   e) Insert a string ’’, expected value is \\’\\’

   f)  If a checkbox cell is double clicked, return value must be 'true'


Thanks
Surinder Kumar






On Fri, May 19, 2017 at 6:08 PM, Surinder Kumar <
surinder.ku...@enterprisedb.com> wrote:

> Hi
>
> Please find updated patch and review.
>
> On Thu, May 18, 2017 at 7:36 PM, Joao Pedro De Almeida Pereira <
> jdealmeidapere...@pivotal.io> wrote:
>
>> Hello Hackers,
>>
>> We reviewed the PR, and there are a lot of new lines of code in this
>> patch, are we sure that we can have a good coverage of the functionality
>> just by doing feature tests?
>> Adding more code to a 3.5k+ lines file doesn't look like a good option,
>> do you think it is possible to extract some of the functionality to their
>> own files and have test around those functionalities?​
>>
> ​To improve the code readability, reduce code complexity and to make code
> testable, the code must be splitted component wise.
> Here is my suggestion:
>
> 1. The code for classes like “SQLEditorView” and “SqlEditorController” can
> be moved into two files like "editor_view.js and “editor_controller.js" and
> called from within "sqleditor.js".
>
> 2. All utilities functions can be moved into separate utils file and can
> write test cases.
>
> 3. Slickgrid listener functions such as:
> ​
> onBeforeEditCell, onKeyDown,
> ​ ​
> onCellChange, onAddNewRow
> ​
> can be moved into
> ​ a file and write test cases around.
>
> This needs discussion. Any suggestion?
>
>>
>> Do we really need to have an epicRandomString function in our code? Would
>> it be better to use a library that would provide us that functionality out
>> of the box?
>>
> We are using "epicRandomString function" to uniquely identify each record,
> I talked to Harshal who is eliminating the use of this function and instead
> maintaining counter for the rows added/updated/deleted.
>
>> The functions this.applyValue in slick.pgadmin.editors.js that were
>> change in this patch are exactly the same, can we extract that code into a
>> single function instead of repeating the code?
>>
> ​I have moved common logic into a new function.​
>
>>
>> Using feature tests is a good option to ensure that the integration of
>> all the components of the application is working as expected, but in order
>> to tests behaviors that are edge cases the Unit Tests are much cheaper to
>> run and create.
>>
> ​I will write test cases for functions once they are moved into their
> separate files as discussed above.
>
>>
>> Thanks
>> Joao & Shruti
>>
>>
>> On Thu, May 18, 2017 at 1:22 AM, Surinder Kumar <
>> surinder.ku...@enterprisedb.com> wrote:
>>
>>> Hi Dave,
>>>
>>> Please review the updated patch.
>>>
>>> On Wed, May 17, 2017 at 8:46 PM, Dave Page  wrote:
>>>
 Hi

 On Wed, May 17, 2017 at 3:08 PM, Surinder Kumar <
 surinder.ku...@enterprisedb.com> wrote:

> Hi Dave,
>
> *Implementation:*
>
> 1) Took a flag 'is_row_copied' for each copied row:
>
>  - to distinguish it from add/update row.
>  - to write code specific to copied row only as it requires different
> logic than add row.
>
> 2) After pasting an existing row:
>
>  - If a user clear the cell value, it must set cell to [default] value
> if default value is explicitly given for column while creating table
> otherwise [null].
>
>  - Again, if a user entered a value in same cell, then removes that
> value, set it to [null] (the same behaviour is for add row).
>
> 3) Took a 2-dimensional array "grid.copied_rows" to keep track the
> changes of each row's cell so that changes made to each cell are
> independent and removed once data is saved.
>
> 4) On pasting a row, the cell must be highlighted with light green
> colour, so triggers an addNewRow event. Now copied row will add to grid
> instead of re-rendering all rows again.
>
> 5) Moved the common logic into functions.
>
> This patch pass the feature test cases and jasmine test case.
> Also I will add the test cases for copy row and send an updated patch.
>
> Please find attached patch and review.
>

 Looks good. I saw the following issues:

 - The "new" row is not available once I've created t

Re: [pgadmin-hackers] [pgAdmin4][Patch]: Feature test for PG Data-types in Query Tool

2017-05-25 Thread Dave Page
Hi

What are the sleeps in pgadmin_page.py for? Can we get rid of them?

On Thu, May 25, 2017 at 6:06 AM, Khushboo Vashi
 wrote:
> Hi,
>
> Please find the attached updated patch.
>
> Thanks,
> Khushboo
>
> On Thu, May 11, 2017 at 2:41 PM, Dave Page  wrote:
>>
>> Hi
>>
>> On Thu, May 11, 2017 at 6:38 AM, Khushboo Vashi
>>  wrote:
>>>
>>> Hi,
>>>
>>> As we have been facing many issues with different data-type display in
>>> Query Tool output, Dave suggested to write the feature test for the same.
>>>
>>> I have started with some basic set of data-type values and will add more.
>>> Please find the attached initial patch for the same.
>>
>>
>> Some thoughts:
>>
>> - Instead of sleeping, which is almost always a bad design, can we wait
>> for objects to appear?
>>
> Fixed
>>
>> - Currently you're testing each datatype with an individual query, e.g.
>>
>> SELECT 32768;
>>
>> I would suggest we test all datatypes at once, e.g.
>>
>> SELECT 32768, 43723489023489, '2017-09-12 15:34:11', 12345.56;
>>
>> etc. That will massively reduce the time taken to execute the tests (which
>> is a big concern).
>>
> Fixed
>>
>> - Shouldn't we be casting the values in the SELECT, so we (and the
>> database) know exactly what we're expecting? e.g.
>>
> Fixed
>>
>> SELECT 32768::int, 43723489023489::bigint, '2017-09-12
>> 15:34:11':timestamp, 12345.56::numeric(8,4);
>>
>> That would also allow us to verify the type name displayed in the column
>> headers.
>>
>> Thanks!
>>
>> --
>> Dave Page
>> Blog: http://pgsnake.blogspot.com
>> Twitter: @pgsnake
>>
>> EnterpriseDB UK: http://www.enterprisedb.com
>> The Enterprise PostgreSQL Company
>
>



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

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


-- 
Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers


[pgadmin-hackers] pgAdmin 4 commit: Add numerous missing checks to ensure objects really

2017-05-25 Thread Dave Page
Add numerous missing checks to ensure objects really exist when we think they 
do. Fixes #2427

Branch
--
master

Details
---
https://git.postgresql.org/gitweb?p=pgadmin4.git;a=commitdiff;h=e9da157cc77b493bda9623a3a4b775bcfec322ab
Author: Murtuza Zabuawala 

Modified Files
--
web/pgadmin/browser/server_groups/__init__.py  |  4 +-
.../server_groups/servers/databases/__init__.py| 12 +++-
.../servers/databases/casts/__init__.py| 17 -
.../servers/databases/event_triggers/__init__.py   | 19 +-
.../servers/databases/extensions/__init__.py   | 16 +++--
.../databases/foreign_data_wrappers/__init__.py| 20 --
.../foreign_servers/__init__.py| 22 ++-
.../foreign_servers/user_mapping/__init__.py   | 22 ++-
.../servers/databases/languages/__init__.py| 19 +-
.../databases/schemas/collations/__init__.py   | 27 ++--
.../servers/databases/schemas/domains/__init__.py  | 60 --
.../schemas/domains/domain_constraints/__init__.py | 22 +--
.../databases/schemas/foreign_tables/__init__.py   | 56 +
.../schemas/fts_configurations/__init__.py | 12 +++-
.../databases/schemas/fts_dictionaries/__init__.py | 13 +++-
.../databases/schemas/fts_parser/__init__.py   | 12 +++-
.../databases/schemas/fts_templates/__init__.py| 20 +-
.../databases/schemas/functions/__init__.py| 29 +++--
.../servers/databases/schemas/packages/__init__.py | 72 +-
.../schemas/packages/edbfuncs/__init__.py  | 11 ++--
.../databases/schemas/packages/edbvars/__init__.py | 10 ++-
.../databases/schemas/sequences/__init__.py| 26 ++--
.../servers/databases/schemas/synonyms/__init__.py | 17 -
.../databases/schemas/tables/column/__init__.py| 27 ++--
.../constraints/check_constraint/__init__.py   | 20 +-
.../constraints/exclusion_constraint/__init__.py   | 18 +-
.../tables/constraints/foreign_key/__init__.py | 16 -
.../constraints/index_constraint/__init__.py   | 24 +++-
.../databases/schemas/tables/indexes/__init__.py   | 23 +--
.../databases/schemas/tables/rules/__init__.py | 20 --
.../databases/schemas/tables/triggers/__init__.py  | 23 +--
.../servers/databases/schemas/types/__init__.py| 31 +++---
.../servers/databases/schemas/views/__init__.py| 30 -
.../server_groups/servers/pgagent/__init__.py  |  6 ++
.../servers/resource_groups/__init__.py| 21 ++-
.../server_groups/servers/tablespaces/__init__.py  | 22 ++-
36 files changed, 683 insertions(+), 136 deletions(-)


-- 
Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers


Re: [pgadmin-hackers] [pgAdmin4] [PATCH] To fix error in SQL panel

2017-05-25 Thread Dave Page
Thanks applied.

On Thu, May 25, 2017 at 6:20 AM, Murtuza Zabuawala
 wrote:
> Hi,
>
> PFA patch to fix the issue which due to python side validations, at many
> places it was assumed that we will always get a row from query result.
> RM#2427
>
> Note: Almost all the database level nodes are affected by this patch.
>
> --
> Regards,
> Murtuza Zabuawala
> EnterpriseDB: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>
>
> --
> Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgadmin-hackers
>



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

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


-- 
Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers


[pgadmin-hackers] Build failed in Jenkins: pgadmin4-master-python27 #128

2017-05-25 Thread pgAdmin 4 Jenkins
See 


Changes:

[Dave Page] Add numerous missing checks to ensure objects really exist when we 
think

--
[...truncated 262.98 KB...]
Get materialized view under schema node ... ok
runTest 
(pgadmin.browser.server_groups.servers.databases.schemas.views.tests.test_views_put.ViewsUpdateTestCase)
Update view under schema node ... ok
runTest 
(pgadmin.browser.server_groups.servers.databases.schemas.views.tests.test_views_put.ViewsUpdateTestCase)
Update materialized view under schema node ... ok
runTest 
(pgadmin.browser.server_groups.servers.databases.tests.test_db_add.DatabaseAddTestCase)
Check Databases Node URL ... ok
runTest 
(pgadmin.browser.server_groups.servers.databases.tests.test_db_delete.DatabaseDeleteTestCase)
Check Databases Node URL ... ok
runTest 
(pgadmin.browser.server_groups.servers.databases.tests.test_db_get.DatabasesGetTestCase)
Check Databases Node URL ... ok
runTest 
(pgadmin.browser.server_groups.servers.databases.tests.test_db_put.DatabasesUpdateTestCase)
Check Databases Node ... ok
runTest 
(pgadmin.browser.server_groups.servers.resource_groups.tests.test_resource_groups_add.ResourceGroupsAddTestCase)
Add resource groups ... ok
runTest 
(pgadmin.browser.server_groups.servers.resource_groups.tests.test_resource_groups_delete.ResourceGroupsDeleteTestCase)
Delete resource groups ... ok
runTest 
(pgadmin.browser.server_groups.servers.resource_groups.tests.test_resource_groups_put.ResourceGroupsPutTestCase)
Put resource groups ... ok
runTest 
(pgadmin.browser.server_groups.servers.resource_groups.tests.tests_resource_groups_get.ResourceGroupsGetTestCase)
Get resource groups ... ok
runTest 
(pgadmin.browser.server_groups.servers.roles.tests.test_role_add.LoginRoleAddTestCase)
Check Role Node ... ok
runTest 
(pgadmin.browser.server_groups.servers.roles.tests.test_role_delete.LoginRoleDeleteTestCase)
Check Role Node ... ok
runTest 
(pgadmin.browser.server_groups.servers.roles.tests.test_role_get.LoginRoleGetTestCase)
Check Role Node ... ok
runTest 
(pgadmin.browser.server_groups.servers.roles.tests.test_role_put.LoginRolePutTestCase)
Check Role Node ... ok
runTest 
(pgadmin.browser.server_groups.servers.tablespaces.tests.test_tbspc_add.TableSpaceAddTestCase)
Check Tablespace Node ... ok
runTest 
(pgadmin.browser.server_groups.servers.tablespaces.tests.test_tbspc_delete.TableSpaceDeleteTestCase)
Check Tablespace Node ... ok
runTest 
(pgadmin.browser.server_groups.servers.tablespaces.tests.test_tbspc_get.TablespaceGetTestCase)
Check Tablespace Node ... ok
runTest 
(pgadmin.browser.server_groups.servers.tablespaces.tests.test_tbspc_put.TableSpaceUpdateTestCase)
Check Tablespace Node ... 2017-05-25 20:34:41,704: ERRORpgadmin:
global name 'sql' is not defined
Traceback (most recent call last):
  File 
"
 line 357, in update
if not isinstance(sql, (str, unicode)):
NameError: global name 'sql' is not defined
FAIL
runTest 
(pgadmin.browser.server_groups.servers.tests.test_check_recovery.TestCheckRecovery)
Test for check recovery ... ok
runTest 
(pgadmin.browser.server_groups.servers.tests.test_dependencies_sql.TestDependenciesSql)
Test dependencies SQL file ... ok
runTest 
(pgadmin.browser.server_groups.servers.tests.test_dependents_sql.TestDependentsSql)
Test dependencies SQL file ... ok
runTest 
(pgadmin.browser.server_groups.servers.tests.test_role_dependencies_sql.TestRoleDependenciesSql)
Test Role Dependencies SQL file ... ok
runTest 
(pgadmin.browser.server_groups.servers.tests.test_server_add.ServersAddTestCase)
Default Server Node url ... ok
runTest 
(pgadmin.browser.server_groups.servers.tests.test_server_delete.ServerDeleteTestCase)
Default Server Node url ... ok
runTest 
(pgadmin.browser.server_groups.servers.tests.test_server_get.ServersGetTestCase)
Default Server Node url ... ok
runTest 
(pgadmin.browser.server_groups.servers.tests.test_server_put.ServerUpdateTestCase)
Default Server Node url ... ok
runTest (pgadmin.browser.server_groups.tests.test_sg_get.SgNodeTestCase)
Check Server Group Node ... ok
runTest 
(pgadmin.utils.tests.test_versioned_template_loader.TestVersionedTemplateLoader)
Test versioned template loader ... ok
runTest 
(regression.python_test_utils.sql_template_test_base.SQLTemplateTestBase)
parent test class ... ok

==
FAIL: runTest 
(pgadmin.browser.server_groups.servers.tablespaces.tests.test_tbspc_put.TableSpaceUpdateTestCase)
Check Tablespace Node
--
Traceback (most recent call last):
  File 
"
 line 58, in runTest

Re: [pgadmin-hackers] [pgAdmin4][Patch][RM_2400]: Columns with defaults set to NULL when removing contents after pasting in the edit grid

2017-05-25 Thread Dave Page
Hi

The tests failed on both PG 9.4 and 9.6 for me :-(

==
ERROR: runTest 
(pgadmin.feature_tests.view_data_dml_queries.CheckForViewDataTest)
Validate Insert, Update operations in View data with given test data
--
Traceback (most recent call last):
  File 
"/Users/dpage/git/pgadmin4/web/pgadmin/feature_tests/view_data_dml_queries.py",
line 120, in runTest
self._verify_insert_data()
  File 
"/Users/dpage/git/pgadmin4/web/pgadmin/feature_tests/view_data_dml_queries.py",
line 316, in _verify_insert_data
self._compare_cell_value(cell_xpath, config_data[str(idx)][1])
  File 
"/Users/dpage/git/pgadmin4/web/pgadmin/feature_tests/view_data_dml_queries.py",
line 165, in _compare_cell_value
"Timed out waiting for element to appear"
  File 
"/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/selenium/webdriver/support/wait.py",
line 80, in until
raise TimeoutException(message, screen, stacktrace)
TimeoutException: Message: Timed out waiting for element to appear

Also, Can we replace the sleep with a "wait for object" or similar?

On Thu, May 25, 2017 at 6:42 AM, Surinder Kumar
 wrote:
> Hi
>
> Please find attached patch for Feature test cases.
>
> The approach is to create a single table 'defaults' with columns of various
> types(number, text, json and boolean) and write test cases for these cell
> types with different input values.
>
> Following are the test cases covered:
>
> 1) Add a new row, save and compare the resulted value with expected values
>
> 2) Copy/Paste row, save and compare cell data
>
> a) Clear cell value and escape, the cell must set to [default]
>
> 3) Update cell:
>
>a) Insert two single quotes(''), expected value is blank string
>
>b) Clear a cell, expected value is [null]
>
>c) Insert a string \’\’, expected value is ''
>
>d) Insert a string \\’\\’, expected value is \’\’
>
>e) Insert a string ’’, expected value is \\’\\’
>
>f)  If a checkbox cell is double clicked, return value must be 'true'
>
>
> Thanks
> Surinder Kumar
>
>
>
>
>
>
> On Fri, May 19, 2017 at 6:08 PM, Surinder Kumar
>  wrote:
>>
>> Hi
>>
>> Please find updated patch and review.
>>
>> On Thu, May 18, 2017 at 7:36 PM, Joao Pedro De Almeida Pereira
>>  wrote:
>>>
>>> Hello Hackers,
>>>
>>> We reviewed the PR, and there are a lot of new lines of code in this
>>> patch, are we sure that we can have a good coverage of the functionality
>>> just by doing feature tests?
>>> Adding more code to a 3.5k+ lines file doesn't look like a good option,
>>> do you think it is possible to extract some of the functionality to their
>>> own files and have test around those functionalities?
>>
>> To improve the code readability, reduce code complexity and to make code
>> testable, the code must be splitted component wise.
>> Here is my suggestion:
>>
>> 1. The code for classes like “SQLEditorView” and “SqlEditorController” can
>> be moved into two files like "editor_view.js and “editor_controller.js" and
>> called from within "sqleditor.js".
>>
>> 2. All utilities functions can be moved into separate utils file and can
>> write test cases.
>>
>> 3. Slickgrid listener functions such as:
>> onBeforeEditCell, onKeyDown,
>> onCellChange, onAddNewRow
>>
>> can be moved into
>> a file and write test cases around.
>>
>> This needs discussion. Any suggestion?
>>>
>>>
>>> Do we really need to have an epicRandomString function in our code? Would
>>> it be better to use a library that would provide us that functionality out
>>> of the box?
>>
>> We are using "epicRandomString function" to uniquely identify each record,
>> I talked to Harshal who is eliminating the use of this function and instead
>> maintaining counter for the rows added/updated/deleted.
>>>
>>> The functions this.applyValue in slick.pgadmin.editors.js that were
>>> change in this patch are exactly the same, can we extract that code into a
>>> single function instead of repeating the code?
>>
>> I have moved common logic into a new function.
>>>
>>>
>>> Using feature tests is a good option to ensure that the integration of
>>> all the components of the application is working as expected, but in order
>>> to tests behaviors that are edge cases the Unit Tests are much cheaper to
>>> run and create.
>>
>> I will write test cases for functions once they are moved into their
>> separate files as discussed above.
>>>
>>>
>>> Thanks
>>> Joao & Shruti
>>>
>>>
>>> On Thu, May 18, 2017 at 1:22 AM, Surinder Kumar
>>>  wrote:

 Hi Dave,

 Please review the updated patch.

 On Wed, May 17, 2017 at 8:46 PM, Dave Page  wrote:
>
> Hi
>
> On Wed, May 17, 2017 at 3:08 PM, Surinder Kumar
>  wrote:
>>
>> Hi Dave,
>>
>> Implementation:
>>
>> 1) Took a flag 'is_row_copied' for each copied row:
>>
>>  - to distinguish it from add/update row.

[pgadmin-hackers] Build failed in Jenkins: pgadmin4-master-python35 #119

2017-05-25 Thread pgAdmin 4 Jenkins
See 


Changes:

[Dave Page] Add numerous missing checks to ensure objects really exist when we 
think

--
[...truncated 262.91 KB...]
Get materialized view under schema node ... ok
runTest 
(pgadmin.browser.server_groups.servers.databases.schemas.views.tests.test_views_put.ViewsUpdateTestCase)
Update view under schema node ... ok
runTest 
(pgadmin.browser.server_groups.servers.databases.schemas.views.tests.test_views_put.ViewsUpdateTestCase)
Update materialized view under schema node ... ok
runTest 
(pgadmin.browser.server_groups.servers.databases.tests.test_db_add.DatabaseAddTestCase)
Check Databases Node URL ... ok
runTest 
(pgadmin.browser.server_groups.servers.databases.tests.test_db_delete.DatabaseDeleteTestCase)
Check Databases Node URL ... ok
runTest 
(pgadmin.browser.server_groups.servers.databases.tests.test_db_get.DatabasesGetTestCase)
Check Databases Node URL ... ok
runTest 
(pgadmin.browser.server_groups.servers.databases.tests.test_db_put.DatabasesUpdateTestCase)
Check Databases Node ... ok
runTest 
(pgadmin.browser.server_groups.servers.resource_groups.tests.test_resource_groups_add.ResourceGroupsAddTestCase)
Add resource groups ... ok
runTest 
(pgadmin.browser.server_groups.servers.resource_groups.tests.test_resource_groups_delete.ResourceGroupsDeleteTestCase)
Delete resource groups ... ok
runTest 
(pgadmin.browser.server_groups.servers.resource_groups.tests.test_resource_groups_put.ResourceGroupsPutTestCase)
Put resource groups ... ok
runTest 
(pgadmin.browser.server_groups.servers.resource_groups.tests.tests_resource_groups_get.ResourceGroupsGetTestCase)
Get resource groups ... ok
runTest 
(pgadmin.browser.server_groups.servers.roles.tests.test_role_add.LoginRoleAddTestCase)
Check Role Node ... ok
runTest 
(pgadmin.browser.server_groups.servers.roles.tests.test_role_delete.LoginRoleDeleteTestCase)
Check Role Node ... ok
runTest 
(pgadmin.browser.server_groups.servers.roles.tests.test_role_get.LoginRoleGetTestCase)
Check Role Node ... ok
runTest 
(pgadmin.browser.server_groups.servers.roles.tests.test_role_put.LoginRolePutTestCase)
Check Role Node ... ok
runTest 
(pgadmin.browser.server_groups.servers.tablespaces.tests.test_tbspc_add.TableSpaceAddTestCase)
Check Tablespace Node ... ok
runTest 
(pgadmin.browser.server_groups.servers.tablespaces.tests.test_tbspc_delete.TableSpaceDeleteTestCase)
Check Tablespace Node ... ok
runTest 
(pgadmin.browser.server_groups.servers.tablespaces.tests.test_tbspc_get.TablespaceGetTestCase)
Check Tablespace Node ... ok
runTest 
(pgadmin.browser.server_groups.servers.tablespaces.tests.test_tbspc_put.TableSpaceUpdateTestCase)
Check Tablespace Node ... 2017-05-25 20:39:42,766: ERRORpgadmin:
name 'sql' is not defined
Traceback (most recent call last):
  File 
"
 line 357, in update
if not isinstance(sql, (str, unicode)):
NameError: name 'sql' is not defined
pgAdmin 4 - Application Initialisation
==

NOTE: Configuring authentication for DESKTOP mode.
Please check output in file: 


FAIL
runTest 
(pgadmin.browser.server_groups.servers.tests.test_check_recovery.TestCheckRecovery)
Test for check recovery ... ok
runTest 
(pgadmin.browser.server_groups.servers.tests.test_dependencies_sql.TestDependenciesSql)
Test dependencies SQL file ... ok
runTest 
(pgadmin.browser.server_groups.servers.tests.test_dependents_sql.TestDependentsSql)
Test dependencies SQL file ... ok
runTest 
(pgadmin.browser.server_groups.servers.tests.test_role_dependencies_sql.TestRoleDependenciesSql)
Test Role Dependencies SQL file ... ok
runTest 
(pgadmin.browser.server_groups.servers.tests.test_server_add.ServersAddTestCase)
Default Server Node url ... ok
runTest 
(pgadmin.browser.server_groups.servers.tests.test_server_delete.ServerDeleteTestCase)
Default Server Node url ... ok
runTest 
(pgadmin.browser.server_groups.servers.tests.test_server_get.ServersGetTestCase)
Default Server Node url ... ok
runTest 
(pgadmin.browser.server_groups.servers.tests.test_server_put.ServerUpdateTestCase)
Default Server Node url ... ok
runTest (pgadmin.browser.server_groups.tests.test_sg_get.SgNodeTestCase)
Check Server Group Node ... ok
runTest 
(pgadmin.utils.tests.test_versioned_template_loader.TestVersionedTemplateLoader)
Test versioned template loader ... ok
runTest 
(regression.python_test_utils.sql_template_test_base.SQLTemplateTestBase)
parent test class ... ok

==
FAIL: runTest 
(pgadmin.browser.server_groups.servers.tablespaces.tests.test_tbspc_put.TableSpaceUpdateTestCase)
Check Tablespace Node

[pgadmin-hackers] Build failed in Jenkins: pgadmin4-master-python26 #240

2017-05-25 Thread pgAdmin 4 Jenkins
See 


Changes:

[Dave Page] Add numerous missing checks to ensure objects really exist when we 
think

--
[...truncated 265.94 KB...]
Get materialized view under schema node ... ok
runTest 
(pgadmin.browser.server_groups.servers.databases.schemas.views.tests.test_views_put.ViewsUpdateTestCase)
Update view under schema node ... ok
runTest 
(pgadmin.browser.server_groups.servers.databases.schemas.views.tests.test_views_put.ViewsUpdateTestCase)
Update materialized view under schema node ... ok
runTest 
(pgadmin.browser.server_groups.servers.databases.tests.test_db_add.DatabaseAddTestCase)
Check Databases Node URL ... ok
runTest 
(pgadmin.browser.server_groups.servers.databases.tests.test_db_delete.DatabaseDeleteTestCase)
Check Databases Node URL ... ok
runTest 
(pgadmin.browser.server_groups.servers.databases.tests.test_db_get.DatabasesGetTestCase)
Check Databases Node URL ... ok
runTest 
(pgadmin.browser.server_groups.servers.databases.tests.test_db_put.DatabasesUpdateTestCase)
Check Databases Node ... ok
runTest 
(pgadmin.browser.server_groups.servers.resource_groups.tests.test_resource_groups_add.ResourceGroupsAddTestCase)
Add resource groups ... ok
runTest 
(pgadmin.browser.server_groups.servers.resource_groups.tests.test_resource_groups_delete.ResourceGroupsDeleteTestCase)
Delete resource groups ... ok
runTest 
(pgadmin.browser.server_groups.servers.resource_groups.tests.test_resource_groups_put.ResourceGroupsPutTestCase)
Put resource groups ... ok
runTest 
(pgadmin.browser.server_groups.servers.resource_groups.tests.tests_resource_groups_get.ResourceGroupsGetTestCase)
Get resource groups ... ok
runTest 
(pgadmin.browser.server_groups.servers.roles.tests.test_role_add.LoginRoleAddTestCase)
Check Role Node ... ok
runTest 
(pgadmin.browser.server_groups.servers.roles.tests.test_role_delete.LoginRoleDeleteTestCase)
Check Role Node ... ok
runTest 
(pgadmin.browser.server_groups.servers.roles.tests.test_role_get.LoginRoleGetTestCase)
Check Role Node ... ok
runTest 
(pgadmin.browser.server_groups.servers.roles.tests.test_role_put.LoginRolePutTestCase)
Check Role Node ... ok
runTest 
(pgadmin.browser.server_groups.servers.tablespaces.tests.test_tbspc_add.TableSpaceAddTestCase)
Check Tablespace Node ... ok
runTest 
(pgadmin.browser.server_groups.servers.tablespaces.tests.test_tbspc_delete.TableSpaceDeleteTestCase)
Check Tablespace Node ... ok
runTest 
(pgadmin.browser.server_groups.servers.tablespaces.tests.test_tbspc_get.TablespaceGetTestCase)
Check Tablespace Node ... ok
runTest 
(pgadmin.browser.server_groups.servers.tablespaces.tests.test_tbspc_put.TableSpaceUpdateTestCase)
Check Tablespace Node ... 2017-05-25 20:44:15,770: ERRORpgadmin:
global name 'sql' is not defined
Traceback (most recent call last):
  File 
"
 line 357, in update
if not isinstance(sql, (str, unicode)):
NameError: global name 'sql' is not defined
FAIL
runTest 
(pgadmin.browser.server_groups.servers.tests.test_check_recovery.TestCheckRecovery)
Test for check recovery ... ok
runTest 
(pgadmin.browser.server_groups.servers.tests.test_dependencies_sql.TestDependenciesSql)
Test dependencies SQL file ... ok
runTest 
(pgadmin.browser.server_groups.servers.tests.test_dependents_sql.TestDependentsSql)
Test dependencies SQL file ... ok
runTest 
(pgadmin.browser.server_groups.servers.tests.test_role_dependencies_sql.TestRoleDependenciesSql)
Test Role Dependencies SQL file ... ok
runTest 
(pgadmin.browser.server_groups.servers.tests.test_server_add.ServersAddTestCase)
Default Server Node url ... ok
runTest 
(pgadmin.browser.server_groups.servers.tests.test_server_delete.ServerDeleteTestCase)
Default Server Node url ... ok
runTest 
(pgadmin.browser.server_groups.servers.tests.test_server_get.ServersGetTestCase)
Default Server Node url ... ok
runTest 
(pgadmin.browser.server_groups.servers.tests.test_server_put.ServerUpdateTestCase)
Default Server Node url ... ok
runTest (pgadmin.browser.server_groups.tests.test_sg_get.SgNodeTestCase)
Check Server Group Node ... ok
runTest 
(pgadmin.utils.tests.test_versioned_template_loader.TestVersionedTemplateLoader)
Test versioned template loader ... ok
runTest 
(regression.python_test_utils.sql_template_test_base.SQLTemplateTestBase)
parent test class ... ok

==
FAIL: runTest 
(pgadmin.browser.server_groups.servers.tablespaces.tests.test_tbspc_put.TableSpaceUpdateTestCase)
Check Tablespace Node
--
Traceback (most recent call last):
  File 
"
 line 58, in runTest

[pgadmin-hackers] Build failed in Jenkins: pgadmin4-master-python36 #119

2017-05-25 Thread pgAdmin 4 Jenkins
See 


Changes:

[Dave Page] Add numerous missing checks to ensure objects really exist when we 
think

--
[...truncated 262.93 KB...]
Get materialized view under schema node ... ok
runTest 
(pgadmin.browser.server_groups.servers.databases.schemas.views.tests.test_views_put.ViewsUpdateTestCase)
Update view under schema node ... ok
runTest 
(pgadmin.browser.server_groups.servers.databases.schemas.views.tests.test_views_put.ViewsUpdateTestCase)
Update materialized view under schema node ... ok
runTest 
(pgadmin.browser.server_groups.servers.databases.tests.test_db_add.DatabaseAddTestCase)
Check Databases Node URL ... ok
runTest 
(pgadmin.browser.server_groups.servers.databases.tests.test_db_delete.DatabaseDeleteTestCase)
Check Databases Node URL ... ok
runTest 
(pgadmin.browser.server_groups.servers.databases.tests.test_db_get.DatabasesGetTestCase)
Check Databases Node URL ... ok
runTest 
(pgadmin.browser.server_groups.servers.databases.tests.test_db_put.DatabasesUpdateTestCase)
Check Databases Node ... ok
runTest 
(pgadmin.browser.server_groups.servers.resource_groups.tests.test_resource_groups_add.ResourceGroupsAddTestCase)
Add resource groups ... ok
runTest 
(pgadmin.browser.server_groups.servers.resource_groups.tests.test_resource_groups_delete.ResourceGroupsDeleteTestCase)
Delete resource groups ... ok
runTest 
(pgadmin.browser.server_groups.servers.resource_groups.tests.test_resource_groups_put.ResourceGroupsPutTestCase)
Put resource groups ... ok
runTest 
(pgadmin.browser.server_groups.servers.resource_groups.tests.tests_resource_groups_get.ResourceGroupsGetTestCase)
Get resource groups ... ok
runTest 
(pgadmin.browser.server_groups.servers.roles.tests.test_role_add.LoginRoleAddTestCase)
Check Role Node ... ok
runTest 
(pgadmin.browser.server_groups.servers.roles.tests.test_role_delete.LoginRoleDeleteTestCase)
Check Role Node ... ok
runTest 
(pgadmin.browser.server_groups.servers.roles.tests.test_role_get.LoginRoleGetTestCase)
Check Role Node ... ok
runTest 
(pgadmin.browser.server_groups.servers.roles.tests.test_role_put.LoginRolePutTestCase)
Check Role Node ... ok
runTest 
(pgadmin.browser.server_groups.servers.tablespaces.tests.test_tbspc_add.TableSpaceAddTestCase)
Check Tablespace Node ... ok
runTest 
(pgadmin.browser.server_groups.servers.tablespaces.tests.test_tbspc_delete.TableSpaceDeleteTestCase)
Check Tablespace Node ... ok
runTest 
(pgadmin.browser.server_groups.servers.tablespaces.tests.test_tbspc_get.TablespaceGetTestCase)
Check Tablespace Node ... ok
runTest 
(pgadmin.browser.server_groups.servers.tablespaces.tests.test_tbspc_put.TableSpaceUpdateTestCase)
Check Tablespace Node ... 2017-05-25 20:49:16,227: ERRORpgadmin:
name 'sql' is not defined
Traceback (most recent call last):
  File 
"
 line 357, in update
if not isinstance(sql, (str, unicode)):
NameError: name 'sql' is not defined
pgAdmin 4 - Application Initialisation
==

NOTE: Configuring authentication for DESKTOP mode.
Please check output in file: 


FAIL
runTest 
(pgadmin.browser.server_groups.servers.tests.test_check_recovery.TestCheckRecovery)
Test for check recovery ... ok
runTest 
(pgadmin.browser.server_groups.servers.tests.test_dependencies_sql.TestDependenciesSql)
Test dependencies SQL file ... ok
runTest 
(pgadmin.browser.server_groups.servers.tests.test_dependents_sql.TestDependentsSql)
Test dependencies SQL file ... ok
runTest 
(pgadmin.browser.server_groups.servers.tests.test_role_dependencies_sql.TestRoleDependenciesSql)
Test Role Dependencies SQL file ... ok
runTest 
(pgadmin.browser.server_groups.servers.tests.test_server_add.ServersAddTestCase)
Default Server Node url ... ok
runTest 
(pgadmin.browser.server_groups.servers.tests.test_server_delete.ServerDeleteTestCase)
Default Server Node url ... ok
runTest 
(pgadmin.browser.server_groups.servers.tests.test_server_get.ServersGetTestCase)
Default Server Node url ... ok
runTest 
(pgadmin.browser.server_groups.servers.tests.test_server_put.ServerUpdateTestCase)
Default Server Node url ... ok
runTest (pgadmin.browser.server_groups.tests.test_sg_get.SgNodeTestCase)
Check Server Group Node ... ok
runTest 
(pgadmin.utils.tests.test_versioned_template_loader.TestVersionedTemplateLoader)
Test versioned template loader ... ok
runTest 
(regression.python_test_utils.sql_template_test_base.SQLTemplateTestBase)
parent test class ... ok

==
FAIL: runTest 
(pgadmin.browser.server_groups.servers.tablespaces.tests.test_tbspc_put.TableSpaceUpdateTestCase)
Check Tablespace Node

[pgadmin-hackers] Build failed in Jenkins: pgadmin4-master-python33 #121

2017-05-25 Thread pgAdmin 4 Jenkins
See 


Changes:

[Dave Page] Add numerous missing checks to ensure objects really exist when we 
think

--
[...truncated 263.10 KB...]
Get materialized view under schema node ... ok
runTest 
(pgadmin.browser.server_groups.servers.databases.schemas.views.tests.test_views_put.ViewsUpdateTestCase)
Update view under schema node ... ok
runTest 
(pgadmin.browser.server_groups.servers.databases.schemas.views.tests.test_views_put.ViewsUpdateTestCase)
Update materialized view under schema node ... ok
runTest 
(pgadmin.browser.server_groups.servers.databases.tests.test_db_add.DatabaseAddTestCase)
Check Databases Node URL ... ok
runTest 
(pgadmin.browser.server_groups.servers.databases.tests.test_db_delete.DatabaseDeleteTestCase)
Check Databases Node URL ... ok
runTest 
(pgadmin.browser.server_groups.servers.databases.tests.test_db_get.DatabasesGetTestCase)
Check Databases Node URL ... ok
runTest 
(pgadmin.browser.server_groups.servers.databases.tests.test_db_put.DatabasesUpdateTestCase)
Check Databases Node ... ok
runTest 
(pgadmin.browser.server_groups.servers.resource_groups.tests.test_resource_groups_add.ResourceGroupsAddTestCase)
Add resource groups ... ok
runTest 
(pgadmin.browser.server_groups.servers.resource_groups.tests.test_resource_groups_delete.ResourceGroupsDeleteTestCase)
Delete resource groups ... ok
runTest 
(pgadmin.browser.server_groups.servers.resource_groups.tests.test_resource_groups_put.ResourceGroupsPutTestCase)
Put resource groups ... ok
runTest 
(pgadmin.browser.server_groups.servers.resource_groups.tests.tests_resource_groups_get.ResourceGroupsGetTestCase)
Get resource groups ... ok
runTest 
(pgadmin.browser.server_groups.servers.roles.tests.test_role_add.LoginRoleAddTestCase)
Check Role Node ... ok
runTest 
(pgadmin.browser.server_groups.servers.roles.tests.test_role_delete.LoginRoleDeleteTestCase)
Check Role Node ... ok
runTest 
(pgadmin.browser.server_groups.servers.roles.tests.test_role_get.LoginRoleGetTestCase)
Check Role Node ... ok
runTest 
(pgadmin.browser.server_groups.servers.roles.tests.test_role_put.LoginRolePutTestCase)
Check Role Node ... ok
runTest 
(pgadmin.browser.server_groups.servers.tablespaces.tests.test_tbspc_add.TableSpaceAddTestCase)
Check Tablespace Node ... ok
runTest 
(pgadmin.browser.server_groups.servers.tablespaces.tests.test_tbspc_delete.TableSpaceDeleteTestCase)
Check Tablespace Node ... ok
runTest 
(pgadmin.browser.server_groups.servers.tablespaces.tests.test_tbspc_get.TablespaceGetTestCase)
Check Tablespace Node ... ok
runTest 
(pgadmin.browser.server_groups.servers.tablespaces.tests.test_tbspc_put.TableSpaceUpdateTestCase)
Check Tablespace Node ... 2017-05-25 20:59:38,980: ERRORpgadmin:
global name 'sql' is not defined
Traceback (most recent call last):
  File 
"
 line 357, in update
if not isinstance(sql, (str, unicode)):
NameError: global name 'sql' is not defined
pgAdmin 4 - Application Initialisation
==

NOTE: Configuring authentication for DESKTOP mode.
Please check output in file: 


FAIL
runTest 
(pgadmin.browser.server_groups.servers.tests.test_check_recovery.TestCheckRecovery)
Test for check recovery ... ok
runTest 
(pgadmin.browser.server_groups.servers.tests.test_dependencies_sql.TestDependenciesSql)
Test dependencies SQL file ... ok
runTest 
(pgadmin.browser.server_groups.servers.tests.test_dependents_sql.TestDependentsSql)
Test dependencies SQL file ... ok
runTest 
(pgadmin.browser.server_groups.servers.tests.test_role_dependencies_sql.TestRoleDependenciesSql)
Test Role Dependencies SQL file ... ok
runTest 
(pgadmin.browser.server_groups.servers.tests.test_server_add.ServersAddTestCase)
Default Server Node url ... ok
runTest 
(pgadmin.browser.server_groups.servers.tests.test_server_delete.ServerDeleteTestCase)
Default Server Node url ... ok
runTest 
(pgadmin.browser.server_groups.servers.tests.test_server_get.ServersGetTestCase)
Default Server Node url ... ok
runTest 
(pgadmin.browser.server_groups.servers.tests.test_server_put.ServerUpdateTestCase)
Default Server Node url ... ok
runTest (pgadmin.browser.server_groups.tests.test_sg_get.SgNodeTestCase)
Check Server Group Node ... ok
runTest 
(pgadmin.utils.tests.test_versioned_template_loader.TestVersionedTemplateLoader)
Test versioned template loader ... ok
runTest 
(regression.python_test_utils.sql_template_test_base.SQLTemplateTestBase)
parent test class ... ok

==
FAIL: runTest 
(pgadmin.browser.server_groups.servers.tablespaces.tests.test_tbspc_put.TableSpaceUpdateTestCase)
Check Tablespace Node
--

[pgadmin-hackers] Build failed in Jenkins: pgadmin4-master-python34 #118

2017-05-25 Thread pgAdmin 4 Jenkins
See 


Changes:

[Dave Page] Add numerous missing checks to ensure objects really exist when we 
think

--
[...truncated 262.96 KB...]
Get materialized view under schema node ... ok
runTest 
(pgadmin.browser.server_groups.servers.databases.schemas.views.tests.test_views_put.ViewsUpdateTestCase)
Update view under schema node ... ok
runTest 
(pgadmin.browser.server_groups.servers.databases.schemas.views.tests.test_views_put.ViewsUpdateTestCase)
Update materialized view under schema node ... ok
runTest 
(pgadmin.browser.server_groups.servers.databases.tests.test_db_add.DatabaseAddTestCase)
Check Databases Node URL ... ok
runTest 
(pgadmin.browser.server_groups.servers.databases.tests.test_db_delete.DatabaseDeleteTestCase)
Check Databases Node URL ... ok
runTest 
(pgadmin.browser.server_groups.servers.databases.tests.test_db_get.DatabasesGetTestCase)
Check Databases Node URL ... ok
runTest 
(pgadmin.browser.server_groups.servers.databases.tests.test_db_put.DatabasesUpdateTestCase)
Check Databases Node ... ok
runTest 
(pgadmin.browser.server_groups.servers.resource_groups.tests.test_resource_groups_add.ResourceGroupsAddTestCase)
Add resource groups ... ok
runTest 
(pgadmin.browser.server_groups.servers.resource_groups.tests.test_resource_groups_delete.ResourceGroupsDeleteTestCase)
Delete resource groups ... ok
runTest 
(pgadmin.browser.server_groups.servers.resource_groups.tests.test_resource_groups_put.ResourceGroupsPutTestCase)
Put resource groups ... ok
runTest 
(pgadmin.browser.server_groups.servers.resource_groups.tests.tests_resource_groups_get.ResourceGroupsGetTestCase)
Get resource groups ... ok
runTest 
(pgadmin.browser.server_groups.servers.roles.tests.test_role_add.LoginRoleAddTestCase)
Check Role Node ... ok
runTest 
(pgadmin.browser.server_groups.servers.roles.tests.test_role_delete.LoginRoleDeleteTestCase)
Check Role Node ... ok
runTest 
(pgadmin.browser.server_groups.servers.roles.tests.test_role_get.LoginRoleGetTestCase)
Check Role Node ... ok
runTest 
(pgadmin.browser.server_groups.servers.roles.tests.test_role_put.LoginRolePutTestCase)
Check Role Node ... ok
runTest 
(pgadmin.browser.server_groups.servers.tablespaces.tests.test_tbspc_add.TableSpaceAddTestCase)
Check Tablespace Node ... ok
runTest 
(pgadmin.browser.server_groups.servers.tablespaces.tests.test_tbspc_delete.TableSpaceDeleteTestCase)
Check Tablespace Node ... ok
runTest 
(pgadmin.browser.server_groups.servers.tablespaces.tests.test_tbspc_get.TablespaceGetTestCase)
Check Tablespace Node ... ok
runTest 
(pgadmin.browser.server_groups.servers.tablespaces.tests.test_tbspc_put.TableSpaceUpdateTestCase)
Check Tablespace Node ... 2017-05-25 20:54:24,476: ERRORpgadmin:
name 'sql' is not defined
Traceback (most recent call last):
  File 
"
 line 357, in update
if not isinstance(sql, (str, unicode)):
NameError: name 'sql' is not defined
pgAdmin 4 - Application Initialisation
==

NOTE: Configuring authentication for DESKTOP mode.
Please check output in file: 


FAIL
runTest 
(pgadmin.browser.server_groups.servers.tests.test_check_recovery.TestCheckRecovery)
Test for check recovery ... ok
runTest 
(pgadmin.browser.server_groups.servers.tests.test_dependencies_sql.TestDependenciesSql)
Test dependencies SQL file ... ok
runTest 
(pgadmin.browser.server_groups.servers.tests.test_dependents_sql.TestDependentsSql)
Test dependencies SQL file ... ok
runTest 
(pgadmin.browser.server_groups.servers.tests.test_role_dependencies_sql.TestRoleDependenciesSql)
Test Role Dependencies SQL file ... ok
runTest 
(pgadmin.browser.server_groups.servers.tests.test_server_add.ServersAddTestCase)
Default Server Node url ... ok
runTest 
(pgadmin.browser.server_groups.servers.tests.test_server_delete.ServerDeleteTestCase)
Default Server Node url ... ok
runTest 
(pgadmin.browser.server_groups.servers.tests.test_server_get.ServersGetTestCase)
Default Server Node url ... ok
runTest 
(pgadmin.browser.server_groups.servers.tests.test_server_put.ServerUpdateTestCase)
Default Server Node url ... ok
runTest (pgadmin.browser.server_groups.tests.test_sg_get.SgNodeTestCase)
Check Server Group Node ... ok
runTest 
(pgadmin.utils.tests.test_versioned_template_loader.TestVersionedTemplateLoader)
Test versioned template loader ... ok
runTest 
(regression.python_test_utils.sql_template_test_base.SQLTemplateTestBase)
parent test class ... ok

==
FAIL: runTest 
(pgadmin.browser.server_groups.servers.tablespaces.tests.test_tbspc_put.TableSpaceUpdateTestCase)
Check Tablespace Node

[pgadmin-hackers] pgAdmin 4 commit: Fix typo in freshly added check.

2017-05-25 Thread Dave Page
Fix typo in freshly added check.

Branch
--
master

Details
---
https://git.postgresql.org/gitweb?p=pgadmin4.git;a=commitdiff;h=2f097cd016b305ca997a9a32c27b2586486fad61

Modified Files
--
web/pgadmin/browser/server_groups/servers/tablespaces/__init__.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)


-- 
Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers


[pgadmin-hackers] Jenkins build is back to normal : pgadmin4-master-python27 #129

2017-05-25 Thread pgAdmin 4 Jenkins
See 




-- 
Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers


Re: [pgadmin-hackers] [pgAdmin4][Patch]: Load module's JS files only when required

2017-05-25 Thread Dave Page
On Tue, May 23, 2017 at 4:21 PM, Dave Page  wrote:
>
> I'm actually thinking that maybe it would be easier to start with the
> CSS files

Which i did yesterday. However, it soon became obvious that that isn't
so easy either, as the CSS files contain url references which need to
be adjusted, which isn't trivial.

However, I did find a flask-webpack module, which looks interesting:

https://github.com/nickjj/flask-webpack
https://nickjanetakis.com/blog/manage-your-assets-with-flask-webpack

Surinder; when you have some free time, could you look into a simple
PoC with the CSS files using that please?

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

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


-- 
Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers


[pgadmin-hackers] Jenkins build is back to normal : pgadmin4-master-python33 #122

2017-05-25 Thread pgAdmin 4 Jenkins
See 




-- 
Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers


[pgadmin-hackers] Jenkins build is back to normal : pgadmin4-master-python36 #120

2017-05-25 Thread pgAdmin 4 Jenkins
See 




-- 
Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers


Re: [pgadmin-hackers] [pgAdmin4][Patch][RM_2400]: Columns with defaults set to NULL when removing contents after pasting in the edit grid

2017-05-25 Thread Joao Pedro De Almeida Pereira
Hello Surinder,

We are having issues running the tests, this is the error that we are
getting:

  File 
"/Users/pivotal/workspace/pgadmin4/web/regression/python_test_utils/test_utils.py",
line 196, in create_table_with_query
pg_cursor.execute(query)
ProgrammingError: role "postgres" does not exist

Traceback (most recent call last):
  File 
"/Users/pivotal/workspace/pgadmin4/web/regression/python_test_utils/test_utils.py",
line 196, in create_table_with_query
pg_cursor.execute(query)
ProgrammingError: relation "defaults_id_seq" does not exist

​

There is already a function that waits for an element to be displayed on
the screen. The function is: self.page.find_by_xpath

In line 179 and 180, both functions do the same thing, why do we need to
wait first and then wait again. Were you experiencing flakiness?

Does _check_xss_in_view_data method checks for Cross Site Scripting?

Was there any reason to duplicate self.page._connects_to_server and
self.page._close_query_tool?

The method _verify_insert_data looks more or less the same code as in the
end of _copy_paste_row, should this be merged?

Thanks,
Joao & Shruti


On Thu, May 25, 2017 at 4:41 PM, Dave Page  wrote:

> Hi
>
> The tests failed on both PG 9.4 and 9.6 for me :-(
>
> ==
> ERROR: runTest (pgadmin.feature_tests.view_data_dml_queries.
> CheckForViewDataTest)
> Validate Insert, Update operations in View data with given test data
> --
> Traceback (most recent call last):
>   File "/Users/dpage/git/pgadmin4/web/pgadmin/feature_tests/
> view_data_dml_queries.py",
> line 120, in runTest
> self._verify_insert_data()
>   File "/Users/dpage/git/pgadmin4/web/pgadmin/feature_tests/
> view_data_dml_queries.py",
> line 316, in _verify_insert_data
> self._compare_cell_value(cell_xpath, config_data[str(idx)][1])
>   File "/Users/dpage/git/pgadmin4/web/pgadmin/feature_tests/
> view_data_dml_queries.py",
> line 165, in _compare_cell_value
> "Timed out waiting for element to appear"
>   File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-
> packages/selenium/webdriver/support/wait.py",
> line 80, in until
> raise TimeoutException(message, screen, stacktrace)
> TimeoutException: Message: Timed out waiting for element to appear
>
> Also, Can we replace the sleep with a "wait for object" or similar?
>
> On Thu, May 25, 2017 at 6:42 AM, Surinder Kumar
>  wrote:
> > Hi
> >
> > Please find attached patch for Feature test cases.
> >
> > The approach is to create a single table 'defaults' with columns of
> various
> > types(number, text, json and boolean) and write test cases for these cell
> > types with different input values.
> >
> > Following are the test cases covered:
> >
> > 1) Add a new row, save and compare the resulted value with expected
> values
> >
> > 2) Copy/Paste row, save and compare cell data
> >
> > a) Clear cell value and escape, the cell must set to [default]
> >
> > 3) Update cell:
> >
> >a) Insert two single quotes(''), expected value is blank string
> >
> >b) Clear a cell, expected value is [null]
> >
> >c) Insert a string \’\’, expected value is ''
> >
> >d) Insert a string \\’\\’, expected value is \’\’
> >
> >e) Insert a string ’’, expected value is \\’\\’
> >
> >f)  If a checkbox cell is double clicked, return value must be 'true'
> >
> >
> > Thanks
> > Surinder Kumar
> >
> >
> >
> >
> >
> >
> > On Fri, May 19, 2017 at 6:08 PM, Surinder Kumar
> >  wrote:
> >>
> >> Hi
> >>
> >> Please find updated patch and review.
> >>
> >> On Thu, May 18, 2017 at 7:36 PM, Joao Pedro De Almeida Pereira
> >>  wrote:
> >>>
> >>> Hello Hackers,
> >>>
> >>> We reviewed the PR, and there are a lot of new lines of code in this
> >>> patch, are we sure that we can have a good coverage of the
> functionality
> >>> just by doing feature tests?
> >>> Adding more code to a 3.5k+ lines file doesn't look like a good option,
> >>> do you think it is possible to extract some of the functionality to
> their
> >>> own files and have test around those functionalities?
> >>
> >> To improve the code readability, reduce code complexity and to make code
> >> testable, the code must be splitted component wise.
> >> Here is my suggestion:
> >>
> >> 1. The code for classes like “SQLEditorView” and “SqlEditorController”
> can
> >> be moved into two files like "editor_view.js and “editor_controller.js"
> and
> >> called from within "sqleditor.js".
> >>
> >> 2. All utilities functions can be moved into separate utils file and can
> >> write test cases.
> >>
> >> 3. Slickgrid listener functions such as:
> >> onBeforeEditCell, onKeyDown,
> >> onCellChange, onAddNewRow
> >>
> >> can be moved into
> >> a file and write test cases around.
> >>
> >> This needs discussion. Any suggestion?
> >>>
> >>>
> >>> Do we really need to have an epicRandomString function in our code?
> Would
> >>> it be b

[pgadmin-hackers] Jenkins build is back to normal : pgadmin4-master-python34 #119

2017-05-25 Thread pgAdmin 4 Jenkins
See 




-- 
Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers


[pgadmin-hackers] Jenkins build is back to normal : pgadmin4-master-python26 #242

2017-05-25 Thread pgAdmin 4 Jenkins
See 




-- 
Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers


[pgadmin-hackers] Jenkins build is back to normal : pgadmin4-master-python35 #121

2017-05-25 Thread pgAdmin 4 Jenkins
See 




-- 
Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers


Re: [pgadmin-hackers] [pgAdmin4][Patch]: Load module's JS files only when required

2017-05-25 Thread Surinder Kumar
On Fri, May 26, 2017 at 3:02 AM, Dave Page  wrote:

> On Tue, May 23, 2017 at 4:21 PM, Dave Page  wrote:
> >
> > I'm actually thinking that maybe it would be easier to start with the
> > CSS files
>
> Which i did yesterday. However, it soon became obvious that that isn't
> so easy either, as the CSS files contain url references which need to
> be adjusted, which isn't trivial.
>
> However, I did find a flask-webpack module, which looks interesting:
>
> https://github.com/nickjj/flask-webpack
> https://nickjanetakis.com/blog/manage-your-assets-with-flask-webpack
>
> Surinder; when you have some free time, could you look into a simple
> PoC with the CSS files using that please?
>
​Ok. I will look

>
> --
> Dave Page
> Blog: http://pgsnake.blogspot.com
> Twitter: @pgsnake
>
> EnterpriseDB UK: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>


Re: [pgadmin-hackers] [pgAdmin4][PATCH] To fix the issue with Node rename

2017-05-25 Thread Ashesh Vashi
On Wed, May 17, 2017 at 8:35 PM, Dave Page  wrote:

>
>
> On Wed, May 17, 2017 at 11:41 AM, Murtuza Zabuawala  enterprisedb.com> wrote:
>
>> Hi Joao,
>>
>> Yes, this patch is related to browser tree issue, In this patch we have
>> fixed some issues with 'onUpdateTreeNode' function to handle some corner
>> cases for server & server-group nodes, Current code for 'onAddTreeNode',
>> 'onUpdateTreeNode', 'onRefreshTreeNode' functions for browser tree is
>> coupled with their respective inner function calls and recursive in nature
>> due to aciTree API implementation for making function calls in orderly
>> manner.
>>
>> @Ashesh,
>> Any thoughts on this?
>>
>
> I'm obviously not Ashesh, but in general, I agree with what Joao suggests
> - treeview related code should be refactored into testable modules, that
> are independent of the tree (for the most part) whenever it makes sense to
> do so, and tests added to aid future replacement of aciTree/Backbone. That
> said, if it's not feasible in a given case, then we should go ahead and fix
> the existing code.
>
Agree with you.
We should go ahead, and check-in the code as of now.

>
> In this case, I'm leaning towards the view that this code is too tightly
> coupled with aciTree to be worth changing more than necessary. What do you
> guys think?
>
Joao,

In general, I agree with the suggestion, but - in this case, it is too
tightly coupled with aciTree.
As we were considering rewriting the browser tree in the POC proposed by
you, we will add necessary tests with that patch.

-- Thanks, Ashesh

>
> --
> Dave Page
> Blog: http://pgsnake.blogspot.com
> Twitter: @pgsnake
>
> EnterpriseDB UK: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>