mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Add API tests for utility check route. Fixes #3790
This commit is contained in:
committed by
Dave Page
parent
d801ed5008
commit
9a3047c89c
@@ -0,0 +1,41 @@
|
||||
##########################################################################
|
||||
#
|
||||
# pgAdmin 4 - PostgreSQL Tools
|
||||
#
|
||||
# Copyright (C) 2013 - 2018, The pgAdmin Development Team
|
||||
# This software is released under the PostgreSQL Licence
|
||||
#
|
||||
##########################################################################
|
||||
|
||||
import sys
|
||||
import json
|
||||
from pgadmin.utils.route import BaseTestGenerator
|
||||
from regression.python_test_utils.test_utils import\
|
||||
check_binary_path_or_skip_test
|
||||
|
||||
if sys.version_info < (3, 3):
|
||||
from mock import patch
|
||||
else:
|
||||
from unittest.mock import patch
|
||||
|
||||
|
||||
class TestUtilityCheckRouteCase(BaseTestGenerator):
|
||||
"""Test to checks the utility route for Backup"""
|
||||
|
||||
scenarios = [
|
||||
('Check utility path route for backup utility', {
|
||||
'url': '/backup/utility_exists/{0}/objects',
|
||||
'expected_success_value': 1
|
||||
})
|
||||
]
|
||||
|
||||
def setUp(self):
|
||||
check_binary_path_or_skip_test(self)
|
||||
|
||||
@patch('pgadmin.tools.backup.is_utility_exists')
|
||||
def runTest(self, is_utility_exists_mock):
|
||||
is_utility_exists_mock.return_value = False
|
||||
response = self.tester.get(self.url.format(1))
|
||||
self.assertEquals(response.status_code, 200)
|
||||
response = json.loads(response.data.decode('utf-8'))
|
||||
self.assertEquals(self.expected_success_value, response['success'])
|
||||
Reference in New Issue
Block a user