Merge "Stop checking if listener exists when uploading cert"

This commit is contained in:
Jenkins 2015-11-04 12:54:30 +00:00 committed by Gerrit Code Review
commit a5fc847427
2 changed files with 1 additions and 13 deletions

View File

@ -258,7 +258,6 @@ def get_listener_status(listener_id):
def upload_certificate(listener_id, filename):
_check_listener_exists(listener_id)
_check_ssl_filename_format(filename)
# create directory if not already there
@ -279,7 +278,6 @@ def upload_certificate(listener_id, filename):
def get_certificate_md5(listener_id, filename):
_check_listener_exists(listener_id)
_check_ssl_filename_format(filename)
cert_path = _cert_file_path(listener_id, filename)

View File

@ -378,12 +378,8 @@ class ServerTestCase(base.TestCase):
@mock.patch('os.path.exists')
def test_get_certificate_md5(self, mock_exists):
CONTENT = "TestTest"
mock_exists.side_effect = [False]
rv = self.app.get('/' + api_server.VERSION +
'/listeners/123/certificates/test.pem')
self.assertEqual(404, rv.status_code)
mock_exists.side_effect = [True, False]
mock_exists.side_effect = [False]
rv = self.app.get('/' + api_server.VERSION +
'/listeners/123/certificates/test.pem')
self.assertEqual(404, rv.status_code)
@ -415,12 +411,6 @@ class ServerTestCase(base.TestCase):
@mock.patch('os.makedirs')
def test_upload_certificate_md5(self, mock_makedir, mock_chmod,
mock_exists):
mock_exists.side_effect = [False]
rv = self.app.put('/' + api_server.VERSION +
'/listeners/123/certificates/test.pem',
data='TestTest')
self.assertEqual(404, rv.status_code)
# wrong file name
mock_exists.side_effect = [True]
rv = self.app.put('/' + api_server.VERSION +