2017-03-16 09:27:55 -05:00
|
|
|
##########################################################################
|
2016-08-09 10:05:40 -05:00
|
|
|
#
|
2017-03-16 09:27:55 -05:00
|
|
|
# pgAdmin 4 - PostgreSQL Tools
|
2016-08-09 10:05:40 -05:00
|
|
|
#
|
2019-01-02 04:24:12 -06:00
|
|
|
# Copyright (C) 2013 - 2019, The pgAdmin Development Team
|
2017-03-16 09:27:55 -05:00
|
|
|
# This software is released under the PostgreSQL Licence
|
2016-08-09 10:05:40 -05:00
|
|
|
#
|
2017-03-16 09:27:55 -05:00
|
|
|
##########################################################################
|
2016-08-09 10:05:40 -05:00
|
|
|
|
2016-09-14 10:26:12 -05:00
|
|
|
from __future__ import print_function
|
|
|
|
|
2016-08-09 10:05:40 -05:00
|
|
|
import json
|
|
|
|
|
|
|
|
SERVER_URL = '/browser/server/obj/'
|
2016-09-19 10:49:06 -05:00
|
|
|
SERVER_CONNECT_URL = '/browser/server/connect/'
|
2018-03-13 14:32:34 -05:00
|
|
|
DUMMY_SERVER_GROUP = 10000
|
2016-08-09 10:05:40 -05:00
|
|
|
|
|
|
|
|
2016-09-14 10:26:12 -05:00
|
|
|
def connect_server(self, server_id):
|
2016-08-09 10:05:40 -05:00
|
|
|
"""
|
|
|
|
This function used to connect added server
|
2016-09-14 10:26:12 -05:00
|
|
|
:param self: class object of server's test class
|
|
|
|
:type self: class
|
2016-09-19 10:49:06 -05:00
|
|
|
:param server_id: server id
|
|
|
|
:type server_id: str
|
2016-08-09 10:05:40 -05:00
|
|
|
"""
|
2018-03-13 14:32:34 -05:00
|
|
|
response = self.tester.post(SERVER_CONNECT_URL + str(DUMMY_SERVER_GROUP) +
|
2016-09-14 10:26:12 -05:00
|
|
|
'/' + str(server_id),
|
|
|
|
data=dict(password=self.server['db_password']),
|
|
|
|
follow_redirects=True)
|
|
|
|
assert response.status_code == 200
|
|
|
|
response_data = json.loads(response.data.decode('utf-8'))
|
|
|
|
return response_data
|