diff options
author | 2019-11-18 16:53:21 +0100 | |
---|---|---|
committer | 2020-01-07 12:11:23 +0100 | |
commit | 0b0a6ca5d765ea2bda591c34b6c995aae00bcd4c (patch) | |
tree | 9c71c58513874b752c8368afec3018940adb6ee9 /dmaap/tests/test_mr_lifecycle.py | |
parent | 8e573aa799c96cbe2a0404e58d67f48eea50b9db (diff) |
Make DMaaP tests independent of each other
The tests in controllerif need not run to make the other tests work.
Use mockconsul instead of test_get_config_service to feed test_dmaapc.
Use mockconsul fixture in all other tests.
Do not wrap actual exceptions with NonRecoverableError in test code.
Signed-off-by: Miroslav Los <miroslav.los@pantheon.tech>
Issue-ID: CCSDK-1937
Change-Id: Iacb229cb8569838cc63932bcf572a6692ffd9124
Diffstat (limited to 'dmaap/tests/test_mr_lifecycle.py')
-rw-r--r-- | dmaap/tests/test_mr_lifecycle.py | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/dmaap/tests/test_mr_lifecycle.py b/dmaap/tests/test_mr_lifecycle.py index 98a9ed5..b2ee713 100644 --- a/dmaap/tests/test_mr_lifecycle.py +++ b/dmaap/tests/test_mr_lifecycle.py @@ -35,7 +35,8 @@ _goodosv2 = { 'username': 'un' } -def test_create_topic(monkeypatch, mockdmaapbc): + +def test_create_topic(monkeypatch, mockconsul, mockdmaapbc): import dmaapplugin from dmaapplugin import mr_lifecycle properties = {'fqdn': 'a.x.example.com', 'openstack': _goodosv2, 'fqtn': 'test_fqtn' } @@ -47,18 +48,11 @@ def test_create_topic(monkeypatch, mockdmaapbc): } ) - try: - current_ctx.set(mock_ctx) - except Exception as e: - raise NonRecoverableError(e) - + current_ctx.set(mock_ctx) + kwargs = { "topic_name": "ONAP_test", "topic_description": "onap dmaap plugin unit test topic"} - try: - mr_lifecycle.create_topic(**kwargs) - mr_lifecycle.get_existing_topic(**kwargs) - mr_lifecycle.delete_topic(**kwargs) - - except Exception as e: - raise NonRecoverableError(e) + mr_lifecycle.create_topic(**kwargs) + mr_lifecycle.get_existing_topic(**kwargs) + mr_lifecycle.delete_topic(**kwargs) |