mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Allow admins to disable the use of Gravatar if they choose. Fixes #3037
This commit is contained in:
committed by
Dave Page
parent
ae5c13188d
commit
abf0b1a7ae
68
web/pgadmin/browser/tests/test_gravatar_image_display.py
Normal file
68
web/pgadmin/browser/tests/test_gravatar_image_display.py
Normal file
@@ -0,0 +1,68 @@
|
||||
##########################################################################
|
||||
#
|
||||
# pgAdmin 4 - PostgreSQL Tools
|
||||
#
|
||||
# Copyright (C) 2013 - 2018, The pgAdmin Development Team
|
||||
# This software is released under the PostgreSQL Licence
|
||||
#
|
||||
##########################################################################
|
||||
|
||||
import config
|
||||
from pgadmin.utils.route import BaseTestGenerator
|
||||
from regression.python_test_utils import test_utils as utils
|
||||
from regression.test_setup import config_data as tconfig
|
||||
|
||||
|
||||
class TestLoginUserImage(BaseTestGenerator):
|
||||
"""
|
||||
This class checks for user image after successful login.
|
||||
- If SHOW_GRAVATAR_IMAGE config option is set to True then we will show
|
||||
Gravatar on the Page.
|
||||
- If SHOW_GRAVATAR_IMAGE config option is set to False then we will show
|
||||
Static image on the Page.
|
||||
"""
|
||||
|
||||
scenarios = [
|
||||
(
|
||||
'Verify gravatar image on the page', dict(
|
||||
email=(
|
||||
tconfig['pgAdmin4_login_credentials']['login_username']
|
||||
),
|
||||
password=(
|
||||
tconfig['pgAdmin4_login_credentials']['login_password']
|
||||
),
|
||||
respdata='Gravatar image for %s' %
|
||||
tconfig['pgAdmin4_login_credentials']
|
||||
['login_username'],
|
||||
)
|
||||
)
|
||||
]
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
"Logout first if already logged in"
|
||||
utils.logout_tester_account(cls.tester)
|
||||
|
||||
def runTest(self):
|
||||
# Login and check type of image in response
|
||||
response = self.tester.post(
|
||||
'/login', data=dict(
|
||||
email=self.email,
|
||||
password=self.password
|
||||
),
|
||||
follow_redirects=True
|
||||
)
|
||||
# Should have gravatar image
|
||||
if config.SHOW_GRAVATAR_IMAGE:
|
||||
self.assertIn(self.respdata, response.data.decode('utf8'))
|
||||
# Should not have gravatar image
|
||||
else:
|
||||
self.assertNotIn(self.respdata, response.data.decode('utf8'))
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
"""
|
||||
We need to again login the test client as soon as test scenarios
|
||||
finishes.
|
||||
"""
|
||||
utils.login_tester_account(cls.tester)
|
||||
@@ -62,13 +62,15 @@ class LoginTestCase(BaseTestGenerator):
|
||||
# This test case validates the valid/correct credentials and allow user
|
||||
# to login pgAdmin 4
|
||||
('Valid_Credentials', dict(
|
||||
email=(config_data['pgAdmin4_login_credentials']
|
||||
['login_username']),
|
||||
password=(config_data['pgAdmin4_login_credentials']
|
||||
['login_password']),
|
||||
respdata='Gravatar image for %s' %
|
||||
config_data['pgAdmin4_login_credentials']
|
||||
['login_username']))
|
||||
email=(config_data[
|
||||
'pgAdmin4_login_credentials'
|
||||
]['login_username']),
|
||||
password=(config_data[
|
||||
'pgAdmin4_login_credentials'
|
||||
]['login_password']),
|
||||
respdata='%s' % config_data['pgAdmin4_login_credentials']
|
||||
['login_username'])
|
||||
)
|
||||
]
|
||||
|
||||
@classmethod
|
||||
|
||||
Reference in New Issue
Block a user