예제 #1
0
 def test_post_nonexistent_repo(self, rest_api):
     """Tests updates in repos using POST with single package."""
     name = packages.PACKAGES_W_REPOS[0][0]
     request_body = tools.gen_updates_body(
         [name], repositories=['nonexistent-1'])
     updates, = rest_api.get_updates(body=request_body).response_check()
     assert not updates.available_updates
예제 #2
0
 def test_post_single(self, rest_api, package):
     """Tests correct updates using POST with single package."""
     name, expected = package
     body = tools.gen_updates_body([name])
     updates = rest_api.get_updates(body=body).response_check()
     schemas.updates_top_schema.validate(updates.raw.body)
     assert len(updates) == 1
     package, = updates
     tools.validate_package_updates(package, expected, exact_match=True)
예제 #3
0
 def test_post_single(self, rest_api, package_record):
     """Tests updates using POST with single package."""
     name, expected_updates = package_record
     request_body = tools.gen_updates_body([name])
     updates = rest_api.get_updates(body=request_body).response_check()
     schemas.updates_top_schema.validate(updates.raw.body)
     assert len(updates) == 1
     package, = updates
     tools.validate_package_updates(package, expected_updates)
예제 #4
0
 def test_post_multi(self, rest_api):
     """Tests updates in repos using POST with multiple packages."""
     request_body = tools.gen_updates_body([p[0] for p in PACKAGES_W_REPOS], repositories=REPOS)
     updates = rest_api.get_updates(body=request_body).response_check()
     schemas.updates_top_repolist_schema.validate(updates.raw.body)
     assert len(updates) == len(PACKAGES_W_REPOS)
     for package_name, expected_updates in PACKAGES_W_REPOS:
         package = updates[package_name]
         tools.validate_package_updates(package, expected_updates)
예제 #5
0
 def test_post_multi(self, rest_api):
     """Tests correct updates using POST with multiple packages."""
     body = tools.gen_updates_body([p[0] for p in packages.PACKAGES_BASIC])
     updates = rest_api.get_updates(body=body).response_check()
     schemas.updates_top_schema.validate(updates.raw.body)
     assert len(updates) == len(packages.PACKAGES_BASIC)
     for name, expected in packages.PACKAGES_BASIC:
         tools.validate_package_updates(updates[name],
                                        expected,
                                        exact_match=True)
예제 #6
0
 def test_post_diff(self):
     """Tests that application returns always the same response using POST."""
     request_body = tools.gen_updates_body(
         [packages.CACHED_PKG])
     rest_api = tools.rest_api()
     init = rest_api.get_updates(body=request_body).response_check()
     for i in range(100):
         rest_api = tools.rest_api()
         response = rest_api.get_updates(body=request_body).response_check()
         assert init.raw.body == response.raw.body
예제 #7
0
 def test_post_single(self, rest_api, package):
     """Tests correct updates in different repo using POST with single package."""
     name, expected = package
     if name in ('test-vmaas-0.3-3.x86_64') and GH(280).blocks:
         pytest.skip('Blocked by GH 280')
     body = tools.gen_updates_body([name])
     updates = rest_api.get_updates(body=body).response_check()
     schemas.updates_top_schema.validate(updates.raw.body)
     assert len(updates) == 1
     package, = updates
     tools.validate_package_updates(package, expected, exact_match=True)
예제 #8
0
 def test_post_single(self, rest_api, package_record):
     """Tests updates with filtered basearch using POST with single package."""
     name, expected_updates = package_record
     request_body = tools.gen_updates_body([name], basearch='i386')
     updates = rest_api.get_updates(body=request_body).response_check()
     schemas.updates_top_basearch_schema.validate(updates.raw.body)
     assert len(updates) == 1
     package, = updates
     tools.validate_package_updates(package, expected_updates)
     for update in package.available_updates:
         assert update['basearch'] == request_body['basearch']
예제 #9
0
 def test_post_multi(self, rest_api):
     """Tests updates with filtered release version using POST with multiple packages."""
     request_body = tools.gen_updates_body(
         [p[0] for p in packages.PACKAGES_RELEASE_FILTER], releasever='6')
     updates = rest_api.get_updates(body=request_body).response_check()
     schemas.updates_top_releasever_schema.validate(updates.raw.body)
     assert len(updates) == len(packages.PACKAGES_RELEASE_FILTER)
     for package_name, expected_updates in packages.PACKAGES_RELEASE_FILTER:
         package = updates[package_name]
         tools.validate_package_updates(package, expected_updates)
         for update in package.available_updates:
             assert update['releasever'] == request_body['releasever']
예제 #10
0
 def test_post_single(self, rest_api, package_record):
     """Tests updates in repos using POST with single package."""
     name, expected_updates = package_record
     request_body = tools.gen_updates_body(
         [name], repositories=packages.REPOS)
     updates = rest_api.get_updates(body=request_body).response_check()
     schemas.updates_top_repolist_schema.validate(updates.raw.body)
     assert len(updates) == 1
     package, = updates
     tools.validate_package_updates(package, expected_updates)
     for update in package.available_updates:
         assert update['repository'] in packages.REPOS
예제 #11
0
 def test_post_multi(self, rest_api):
     """Tests correct updates from i386 package with basearch set to x86_64
     using POST with multiple packages.
     """
     body = tools.gen_updates_body(
         [p[0] for p in packages.PACKAGES_I386_W_FILTER], basearch='x86_64')
     updates = rest_api.get_updates(body=body).response_check()
     schemas.updates_top_basearch_schema.validate(updates.raw.body)
     assert len(updates) == len(packages.PACKAGES_I386_W_FILTER)
     for name, expected in packages.PACKAGES_I386_W_FILTER:
         tools.validate_package_updates(updates[name],
                                        expected,
                                        exact_match=True)
예제 #12
0
def cache_bash():
    """Cache responses for bash package update request, with and without filters.


    It *have to be run at the beginning of test suite* to cache response w/
    filters to one process and response w/o filters to the other one.
    Each process of webapp has its own cache.
    Application will cache response from tests otherwise and there could be
    same cached response if we don't run this first.

    Helps to catch https://github.com/RedHatInsights/vmaas/issues/306
    """

    rest_api = tools.rest_api()
    # cache response for plain bash updates
    request_body = tools.gen_updates_body([packages.CACHED_PKG])
    rest_api.get_updates(body=request_body).response_check()
    # cache reponse for bash updates with filter
    rest_api = tools.rest_api()
    request_body = tools.gen_updates_body([packages.CACHED_PKG],
                                          releasever='7Server')
    rest_api.get_updates(body=request_body).response_check()
예제 #13
0
 def test_post_single(self, rest_api, package):
     """Tests correct updates from i386 package with basearch set to x86_64
     using POST with single package.
     """
     name, expected = package
     if name in ('test-arch-vmaas-1-1.i386',
                 'test-arch-vmaas-2-2.i386') and GH(273).blocks:
         pytest.skip('Blocked by GH 273')
     body = tools.gen_updates_body([name], basearch='x86_64')
     updates = rest_api.get_updates(body=body).response_check()
     schemas.updates_top_basearch_schema.validate(updates.raw.body)
     assert len(updates) == 1
     package, = updates
     tools.validate_package_updates(package, expected, exact_match=True)