From 8c4fa2017c74d67bb65cbbe6ac8d399982e4d9b3 Mon Sep 17 00:00:00 2001 From: Yuvaraju Meenuga Date: Mon, 4 Feb 2019 17:52:01 +0530 Subject: [PATCH] Fix failing old test cases. Some of the Functional test cases are failing while trying to serialize a mock object. This code changes should be fixing them. --- poppy/storage/mockdb/certificates.py | 3 ++- tests/functional/transport/pecan/base.py | 2 ++ .../transport/pecan/controllers/test_set_service_status.py | 5 +++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/poppy/storage/mockdb/certificates.py b/poppy/storage/mockdb/certificates.py index cd2eb811..caba9808 100644 --- a/poppy/storage/mockdb/certificates.py +++ b/poppy/storage/mockdb/certificates.py @@ -77,4 +77,5 @@ def get_certs_by_domain(self, domain_name, project_id=None, if len(certs) == 1: return certs[0] else: - return certs + raise ValueError("No matching certificates found for " + "the domain {}".format(domain_name)) diff --git a/tests/functional/transport/pecan/base.py b/tests/functional/transport/pecan/base.py index 5d33f859..080b11e3 100644 --- a/tests/functional/transport/pecan/base.py +++ b/tests/functional/transport/pecan/base.py @@ -61,6 +61,8 @@ def setUp(self): mock_cert_info = mock.MagicMock() mock_cert_info.get_cert_config.return_value = {} + mock_cert_info.get_san_cert_hostname_limit.return_value = 0 + mock_cert_info.update_cert_config.return_value = {} mod_san_q = mock.MagicMock() mod_san_q.traverse_queue.return_value = [] diff --git a/tests/functional/transport/pecan/controllers/test_set_service_status.py b/tests/functional/transport/pecan/controllers/test_set_service_status.py index c509e70e..0bd02a61 100644 --- a/tests/functional/transport/pecan/controllers/test_set_service_status.py +++ b/tests/functional/transport/pecan/controllers/test_set_service_status.py @@ -152,11 +152,12 @@ def test_services_state_invalid_service_id(self, service_id): self.assertEqual(response.status_code, 400) - @given(strategies.text(min_size=257)) - def test_services_state_invalid_project_id(self, project_id): + def test_services_state_invalid_project_id(self): # NOTE(TheSriram): the min size is assigned to 257, since # project_id regex allows up to 256 chars # invalid project_id field + project_id = '_'.join([str(uuid.uuid4()) for i in range(7)]) + self.assertTrue(len(project_id) > 256) self.req_body['project_id'] = project_id self.req_body['status'] = 'deployed' response = self.app.post(