Merge "Added additional wsgi app testing"
This commit is contained in:
commit
806bbb17c9
|
@ -47,9 +47,10 @@ class Service(service.WSGIService):
|
|||
api_paste_config = cfg.CONF['service:api'].api_paste_config
|
||||
config_paths = utils.find_config(api_paste_config)
|
||||
|
||||
if len(config_paths) == 0:
|
||||
msg = 'Unable to determine appropriate api-paste-config file'
|
||||
raise exceptions.ConfigurationError(msg)
|
||||
if not config_paths:
|
||||
raise exceptions.ConfigurationError(
|
||||
'Unable to determine appropriate api-paste-config file'
|
||||
)
|
||||
|
||||
LOG.info('Using api-paste-config found at: %s', config_paths[0])
|
||||
|
||||
|
|
|
@ -13,7 +13,13 @@
|
|||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
from unittest import mock
|
||||
|
||||
|
||||
from paste import urlmap
|
||||
|
||||
from designate.api import service
|
||||
from designate import exceptions
|
||||
from designate.tests.test_api import ApiTestCase
|
||||
|
||||
|
||||
|
@ -29,3 +35,14 @@ class ApiServiceTest(ApiTestCase):
|
|||
# NOTE: Start is already done by the fixture in start_service()
|
||||
self.service.start()
|
||||
self.service.stop()
|
||||
|
||||
def test_get_wsgi_application(self):
|
||||
self.assertIsInstance(self.service.wsgi_application, urlmap.URLMap)
|
||||
|
||||
@mock.patch('designate.utils.find_config')
|
||||
def test_unable_to_find_config(self, mock_find_config):
|
||||
mock_find_config.return_value = list()
|
||||
with self.assertRaisesRegex(
|
||||
exceptions.ConfigurationError,
|
||||
'Unable to determine appropriate api-paste-config file'):
|
||||
self.assertFalse(self.service.wsgi_application)
|
||||
|
|
Loading…
Reference in New Issue