Skip to content

Commit

Permalink
Add proxy sync test
Browse files Browse the repository at this point in the history
  • Loading branch information
ehelms committed Jan 7, 2021
1 parent e4ee39e commit 1bc6b61
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,17 @@ def api(user, base_url):
api_version=2,
verify_ssl=False,
)


@pytest.fixture(scope='session')
def entities():
return {
'organization_label': 'Test_Organization',
'activation_key': 'Test AK',
'product': 'Test Product',
'product_label': 'Test_Product',
'yum_repository': 'Zoo',
'yum_repository_label': 'Zoo',
'errata_id': 'RHEA-2012:0055',
'container_repository_label': 'foremanbusybox'
}
40 changes: 40 additions & 0 deletions tests/test_smart_proxy.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import pytest


@pytest.fixture
def content_smart_proxy(api, organization):
smart_proxies = api.resource('smart_proxies').call('index', {'sort_by': 'id', 'sort_order': 'DESC'})
content_proxy = smart_proxies['results'][0]
content_proxy_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']})

0 comments on commit 1bc6b61

Please sign in to comment.