mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2026-11-01 15:53:03 -06:00
1) Replace the deprecated unit test method. 2) Wraps filter usage in a list call. 3) Converts the old metaclass syntax to new. 4) Use range instead of xrange method. 5) Change Unicode to str. 6) Several other transformations. 7) Fixed change password test cases. 8) Use simplejson instead of plain JSON.
40 lines
1.3 KiB
Python
40 lines
1.3 KiB
Python
#######################################################################
|
|
#
|
|
# pgAdmin 4 - PostgreSQL Tools
|
|
#
|
|
# Copyright (C) 2013 - 2020, The pgAdmin Development Team
|
|
# This software is released under the PostgreSQL Licence
|
|
#
|
|
##########################################################################
|
|
from pgadmin.utils.compile_template_name import compile_template_name
|
|
from pgadmin.utils.route import BaseTestGenerator
|
|
|
|
|
|
class TestCompileTemplateName(BaseTestGenerator):
|
|
scenarios = [
|
|
(
|
|
'When server is Postgres and version is 10, it returns the path '
|
|
'to the postgres template',
|
|
dict(
|
|
server_type='pg',
|
|
version=100000,
|
|
expected_return_value='some/prefix/#100000#/some_file.sql'
|
|
)
|
|
),
|
|
(
|
|
'When server is GreenPlum and version is 5, it returns the path '
|
|
'to the GreenPlum template',
|
|
dict(
|
|
server_type='gpdb',
|
|
version=80323,
|
|
expected_return_value='some/prefix/#gpdb#80323#/some_file.sql'
|
|
)
|
|
),
|
|
]
|
|
|
|
def runTest(self):
|
|
result = compile_template_name(
|
|
'some/prefix', 'some_file.sql', self.server_type, self.version
|
|
)
|
|
self.assertEqual(result, self.expected_return_value)
|