From 26802b294bb079bb763a5c9d4a6d50161ee09712 Mon Sep 17 00:00:00 2001 From: "Eric D. Helms" Date: Mon, 14 Dec 2020 16:06:23 +0000 Subject: [PATCH] Add proxy sync test --- tests/test_smart_proxy.py | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 tests/test_smart_proxy.py diff --git a/tests/test_smart_proxy.py b/tests/test_smart_proxy.py new file mode 100644 index 0000000..3c3e421 --- /dev/null +++ b/tests/test_smart_proxy.py @@ -0,0 +1,39 @@ +import pytest + + +@pytest.fixture +def content_smart_proxy(api, organization): + content_proxy_id = '2' + content_proxy = api.resource('smart_proxies').call('show', {'id': content_proxy_id}) + + environments = api.resource('capsule_content').call('lifecycle_environments', { + 'id': content_proxy['id'] + })['results'] + + for environment in environments: + response = api.resource('capsule_content').call('remove_lifecycle_environment', { + 'id': content_proxy_id, + 'environment_id': environment['id'] + }) + + library = api.resource('lifecycle_environments').call('index', { + 'search': 'Library', + 'organization_id': organization['id'] + })['results'][0] + + api.resource('capsule_content').call('add_lifecycle_environment', { + 'id': content_proxy_id, + 'environment_id': library['id'] + }) + + return content_proxy + +@pytest.fixture +def organization(api, entities): + return api.resource('organizations').call('index', { + 'search': entities['organization_label'] + })['results'][0] + + +def test_smart_proxy_content_sync(api, content_smart_proxy): + assert api.resource('capsule_content').call('sync', {'id': content_smart_proxy['id']})