public inbox for [email protected]  
help / color / mirror / Atom feed
From: Pradip Parkale <[email protected]>
To: Akshay Joshi <[email protected]>
Cc: pgadmin-hackers <[email protected]>
Subject: Re: [pgAdmin][RM5867]:Some properties are not getting updated correctly if the server is shared server.
Date: Wed, 30 Sep 2020 22:55:50 +0530
Message-ID: <CAJ9T6StbGYP1yh-TuBcpWZ=k7Y+HZeC47HW4HrKzPE6_kdBVGA@mail.gmail.com> (raw)
In-Reply-To: <CANxoLDfcyyHdfif9TB1PfGd3v+CY5a3Dw4pwB39vUWNwLDeP8w@mail.gmail.com>
References: <CAJ9T6SuxrZ9Yq5D0PMVMhP+0_HG=51aKiLPXGGG3_zV1HMD3bA@mail.gmail.com>
	<CANxoLDfcyyHdfif9TB1PfGd3v+CY5a3Dw4pwB39vUWNwLDeP8w@mail.gmail.com>

Hi Akshay,
Please find the attached patch for the API failure issue.

On Wed, Sep 30, 2020 at 12:34 PM Akshay Joshi <[email protected]>
wrote:

> Thanks, patch applied.
>
> On Wed, Sep 30, 2020 at 11:00 AM Pradip Parkale <
> [email protected]> wrote:
>
>> Hi Hackers,
>>
>> Please find the attached patch for the below issues.
>>
>>    1. Shared with all? changed to 'Shared?'.
>>    2. Hide shared server? changed to 'Hide shared servers?'.
>>    3. Some properties of the base server were getting updated if the
>>    user updated the shared server properties so I fixed this issue.
>>    4. Fixed an issue where 'Later' and 'Refresh' button labels were
>>    getting override on disconnect server confirmation dialogue.
>>    5. If the user shares an auto-detected server and other user log-in
>>    then the auto-detected server of the second user will not be visible, the
>>    second user will see a shared auto-detected server.
>>
>>
>> --
>> Thanks & Regards,
>> Pradip Parkale
>> Software Engineer | EnterpriseDB Corporation
>>
>
>
> --
> *Thanks & Regards*
> *Akshay Joshi*
> *pgAdmin Hacker | Sr. Software Architect*
> *EDB Postgres <http://edbpostgres.com>*
>
> *Mobile: +91 976-788-8246*
>


-- 
Thanks & Regards,
Pradip Parkale
Software Engineer | EnterpriseDB Corporation


Attachments:

  [application/octet-stream] jenkins_issue.patch (3.4K, 3-jenkins_issue.patch)
  download | inline diff:
diff --git a/web/pgadmin/browser/server_groups/servers/tests/test_all_server_get.py b/web/pgadmin/browser/server_groups/servers/tests/test_all_server_get.py
index cd35a7a05..a8de9056f 100644
--- a/web/pgadmin/browser/server_groups/servers/tests/test_all_server_get.py
+++ b/web/pgadmin/browser/server_groups/servers/tests/test_all_server_get.py
@@ -12,6 +12,7 @@ from pgadmin.utils.route import BaseTestGenerator
 from regression import parent_node_dict
 from regression.python_test_utils import test_utils as utils
 from . import utils as servers_utils
+import json
 
 
 class AllServersGetTestCase(BaseTestGenerator):
@@ -25,8 +26,22 @@ class AllServersGetTestCase(BaseTestGenerator):
 
     def setUp(self):
         """This function add the server to test the GET API"""
-        self.server['password'] = 'edb'
-        self.server_id = utils.create_server(self.server)
+
+        server_details = servers_utils.get_server_data(self.server)
+        server_details['password'] = self.server['db_password']
+        server_details['save_password'] = 1
+        server_details['connect_now'] = 1
+
+        url = "/browser/server/obj/{0}/".format(utils.SERVER_GROUP)
+
+        response = self.tester.post(
+            url,
+            data=json.dumps(server_details),
+            content_type='html/json'
+        )
+        response_data = json.loads(response.data.decode('utf-8'))
+        self.server_id = response_data['node']['_id']
+
         server_dict = {"server_id": self.server_id}
         utils.write_node_info("sid", server_dict)
 
@@ -53,7 +68,7 @@ class AllServersGetTestCase(BaseTestGenerator):
             elif hasattr(self, 'children'):
 
                 self.url = self.url + '{0}/{1}'.format(
-                    utils.SERVER_GROUP, server_id)
+                    utils.SERVER_GROUP, self.server_id)
             elif hasattr(self, 'server_list'):
                 if hasattr(self, 'servers'):
                     server_id = ''
@@ -64,7 +79,7 @@ class AllServersGetTestCase(BaseTestGenerator):
                     url = '/browser/server/connect/' + '{0}/{1}'.format(
                         utils.SERVER_GROUP,
                         self.server_id)
-                    self.server['password'] = 'edb'
+                    self.server['password'] = self.server['db_password']
 
                     self.connect_to_server(url)
                 self.url = self.url + '{0}/{1}?_={2}'.format(
diff --git a/web/pgadmin/browser/server_groups/servers/tests/utils.py b/web/pgadmin/browser/server_groups/servers/tests/utils.py
index 8680b29fb..56d475a90 100644
--- a/web/pgadmin/browser/server_groups/servers/tests/utils.py
+++ b/web/pgadmin/browser/server_groups/servers/tests/utils.py
@@ -50,3 +50,25 @@ def create_server_with_api(self, url):
         return server_id
     except Exception as exception:
         raise Exception("Error while creating server. %s" % exception)
+
+
+def get_server_data(server):
+    """
+    This function returns the server details
+    :param server:
+    :return: server data
+    """
+
+    server_data = \
+        {
+            "name": server['name'],
+            "comment": server['comment'],
+            "username": server['username'],
+            "host": server['host'],
+            "db_password": server['db_password'],
+            "port": server['port'],
+            "sslmode": server['sslmode'],
+            "db": server['db']
+        }
+
+    return server_data


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], [email protected]
  Subject: Re: [pgAdmin][RM5867]:Some properties are not getting updated correctly if the server is shared server.
  In-Reply-To: <CAJ9T6StbGYP1yh-TuBcpWZ=k7Y+HZeC47HW4HrKzPE6_kdBVGA@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