Add API tests for utility check route. Fixes #3790

This commit is contained in:
Murtuza Zabuawala
2018-11-30 09:56:41 +00:00
committed by Dave Page
parent d801ed5008
commit 9a3047c89c
6 changed files with 184 additions and 0 deletions

View File

@@ -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'])