From 633828fbd6d9d3e6d396da8e670b5b921a20114f Mon Sep 17 00:00:00 2001 From: jbleclere Date: Wed, 13 Jul 2022 14:02:18 +0000 Subject: [PATCH] Update some tests --- tests/test_async_health.py | 2 +- tests/test_entitlement.py | 14 +++++++------- tests/test_metered_mode_on_hw.py | 4 ++-- tests/test_nodelock_mode_on_hw.py | 4 ++-- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/tests/test_async_health.py b/tests/test_async_health.py index f9d6b061..73feb11a 100644 --- a/tests/test_async_health.py +++ b/tests/test_async_health.py @@ -112,7 +112,7 @@ def test_health_period_modification(accelize_drm, conf_json, cred_json, async_ha wait_start = data_list.pop(0)[1] for i, (start, end) in enumerate(data_list): delta = parser.parse(start) - parser.parse(wait_start) - assert int(delta.total_seconds()) == healthPeriod + i + assert int(delta.total_seconds()) >= healthPeriod wait_start = end assert get_proxy_error() is None diff --git a/tests/test_entitlement.py b/tests/test_entitlement.py index f7a91e25..706c9f49 100644 --- a/tests/test_entitlement.py +++ b/tests/test_entitlement.py @@ -34,7 +34,7 @@ def test_entitlement_user1_metering(accelize_drm, conf_json, cred_json, async_ha drm_manager.activate() assert "Metering Web Service error 400" in str(excinfo.value) assert "DRM WS request failed" in str(excinfo.value) - assert search(r'\\"No Entitlement\\" with .+ for \S+_test_01@accelize.com', str(excinfo.value)) + assert search(r'No Entitlement.* with PT DRM Ref Design .+ for \S+_test_01@accelize.com', str(excinfo.value)) assert "User account has no entitlement. Purchase additional licenses via your portal" in str(excinfo.value) assert async_handler.get_error_code(str(excinfo.value)) == accelize_drm.exceptions.DRMWSReqError.error_code async_cb.assert_Error(accelize_drm.exceptions.DRMWSReqError.error_code, 'User account has no entitlement. Purchase additional licenses via your portal') @@ -74,7 +74,7 @@ def test_entitlement_user1_nodelock(accelize_drm, conf_json, cred_json, async_ha drm_manager.activate() assert "Metering Web Service error 400" in str(excinfo.value) assert "DRM WS request failed" in str(excinfo.value) - assert search(r'\\"No Entitlement\\" with .+ for \S+_test_01@accelize.com', str(excinfo.value)) + assert search(r'No Entitlement.* with PT DRM Ref Design .+ for \S+_test_01@accelize.com', str(excinfo.value)) assert "User account has no entitlement. Purchase additional licenses via your portal" in str(excinfo.value) assert async_handler.get_error_code(str(excinfo.value)) == accelize_drm.exceptions.DRMWSReqError.error_code async_cb.assert_Error(accelize_drm.exceptions.DRMWSReqError.error_code, 'User account has no entitlement. Purchase additional licenses via your portal') @@ -116,7 +116,7 @@ def test_entitlement_user2_metering(accelize_drm, conf_json, cred_json, async_ha drm_manager.deactivate() async_cb.assert_NoError() log_content = logfile.read() - assert search(r'DRM session .{16} created', log_content, MULTILINE) + assert search(r'DRM session .{16} started', log_content, MULTILINE) logfile.remove() @@ -150,7 +150,7 @@ def test_entitlement_user2_nodelock(accelize_drm, conf_json, cred_json, async_ha drm_manager.activate() assert "Metering Web Service error 400" in str(excinfo.value) assert "DRM WS request failed" in str(excinfo.value) - assert search(r'\\"No Entitlement\\" with .+ for \S+_test_02@accelize.com', str(excinfo.value)) + assert search(r'No Entitlement.* with PT DRM Ref Design .+ for \S+_test_02@accelize.com', str(excinfo.value)) assert 'No valid NodeLocked entitlement found for your account' in str(excinfo.value) assert async_handler.get_error_code(str(excinfo.value)) == accelize_drm.exceptions.DRMWSReqError.error_code async_cb.assert_Error(accelize_drm.exceptions.DRMWSReqError.error_code, 'No valid NodeLocked entitlement found for your account') @@ -193,7 +193,7 @@ def test_entitlement_user3_metering(accelize_drm, conf_json, cred_json, async_ha drm_manager.deactivate() async_cb.assert_NoError() log_content = logfile.read() - assert search(r'DRM session .{16} created', log_content, MULTILINE) + assert search(r'DRM session .{16} started', log_content, MULTILINE) logfile.remove() @@ -265,7 +265,7 @@ def test_entitlement_user4_metering(accelize_drm, conf_json, cred_json, async_ha drm_manager.deactivate() async_cb.assert_NoError() log_content = logfile.read() - assert search(r'DRM session .{16} created', log_content, MULTILINE) + assert search(r'DRM session .{16} started', log_content, MULTILINE) logfile.remove() @@ -299,7 +299,7 @@ def test_entitlement_user4_nodelock(accelize_drm, conf_json, cred_json, async_ha drm_manager.activate() assert "Metering Web Service error 400" in str(excinfo.value) assert "DRM WS request failed" in str(excinfo.value) - assert search(r'\\"No Entitlement\\" with .+ for \S+_test_04@accelize.com', str(excinfo.value)) + assert search(r'No Entitlement.* with PT DRM Ref Design .+ for \S+_test_04@accelize.com', str(excinfo.value)) assert 'No valid NodeLocked entitlement found for your account' in str(excinfo.value) assert async_handler.get_error_code(str(excinfo.value)) == accelize_drm.exceptions.DRMWSReqError.error_code async_cb.assert_Error(accelize_drm.exceptions.DRMWSReqError.error_code, 'No valid NodeLocked entitlement found for your account') diff --git a/tests/test_metered_mode_on_hw.py b/tests/test_metered_mode_on_hw.py index 936ed077..61ef12d3 100644 --- a/tests/test_metered_mode_on_hw.py +++ b/tests/test_metered_mode_on_hw.py @@ -485,7 +485,7 @@ def test_metering_limits_on_activate(accelize_drm, conf_json, cred_json, async_h drm_manager.activate() assert 'Metering Web Service error 400' in str(excinfo.value) assert 'DRM WS request failed' in str(excinfo.value) - assert search(r'\\"Entitlement Limit Reached\\" with .+ for \S+_test_03@accelize.com', str(excinfo.value)) + assert search(r'"Entitlement Limit Reached.* with PT DRM Ref Design .+ for \S+_test_03@accelize.com', str(excinfo.value)) assert 'You have reached the maximum quantity of 1000. usage_unit for metered entitlement (licensed)' in str(excinfo.value) assert async_handler.get_error_code(str(excinfo.value)) == accelize_drm.exceptions.DRMWSReqError.error_code async_cb.assert_Error(accelize_drm.exceptions.DRMWSReqError.error_code, 'You have reached the maximum quantity of 1000. usage_unit for metered entitlement') @@ -543,7 +543,7 @@ def test_metering_limits_on_licensing_thread(accelize_drm, conf_json, cred_json, assert async_cb.was_called assert 'Metering Web Service error 400' in async_cb.message assert 'DRM WS request failed' in async_cb.message - assert search(r'\\"Entitlement Limit Reached\\" with .+ for \S+_test_03@accelize.com', async_cb.message) + assert search(r'"Entitlement Limit Reached.* with PT DRM Ref Design .+ for \S+_test_03@accelize.com', async_cb.message) assert 'You have reached the maximum quantity of 1000. usage_unit for metered entitlement (licensed)' in async_cb.message assert async_cb.errcode == accelize_drm.exceptions.DRMWSReqError.error_code drm_manager.deactivate() diff --git a/tests/test_nodelock_mode_on_hw.py b/tests/test_nodelock_mode_on_hw.py index ad080a8f..78351653 100644 --- a/tests/test_nodelock_mode_on_hw.py +++ b/tests/test_nodelock_mode_on_hw.py @@ -82,7 +82,7 @@ def test_nodelock_license_is_not_given_to_inactive_user(accelize_drm, conf_json, with pytest.raises(accelize_drm.exceptions.DRMWSReqError) as excinfo: drm_manager.activate() assert 'Metering Web Service error 400' in str(excinfo.value) - assert search(r'\\"No Entitlement\\" with .+ for \S+_test_01@accelize.com', str(excinfo.value)) + assert search(r'No Entitlement.* with PT DRM Ref Design .+ for \S+_test_01@accelize.com', str(excinfo.value)) assert 'User account has no entitlement. Purchase additional licenses via your portal.' in str(excinfo.value) err_code = async_handler.get_error_code(str(excinfo.value)) assert err_code == accelize_drm.exceptions.DRMWSReqError.error_code @@ -322,7 +322,7 @@ def test_nodelock_limits(accelize_drm, conf_json, conf_json_second, cred_json, a drm_manager1.activate() assert 'Metering Web Service error 400' in str(excinfo.value) assert 'DRM WS request failed' in str(excinfo.value) - assert search(r'\\"Entitlement Limit Reached\\" with .+ for \S+_test_03@accelize.com', str(excinfo.value)) + assert search(r'"Entitlement Limit Reached.* with PT DRM Ref Design .+ for \S+_test_03@accelize.com', str(excinfo.value)) assert 'You have reached the maximum quantity of 1 nodes for Nodelocked entitlement' in str(excinfo.value) err_code = async_handler.get_error_code(str(excinfo.value)) assert err_code == accelize_drm.exceptions.DRMWSReqError.error_code