Skip to content

Commit

Permalink
Update the new docker tests
Browse files Browse the repository at this point in the history
Do the following:

* Make the new tests run only if Pulp 2.8 or above is targeted.
* Add reStructuredText API documentation stubs.
* Tweak some formatting.

Test results:

    ============  ==================
    Pulp Version  Test Suite Results
    ============  ==================
    2.7           OK (skipped=1)
    dev (2.8)     OK
    ============  ==================

Command used to generate test results:

    PULP_SMASH_CONFIG_FILE=$PS_CONFIG \
    python -m unittest2 pulp_smash.tests.docker.api_v2.test_crud
  • Loading branch information
Ichimonji10 committed Dec 17, 2015
1 parent 129f682 commit 668f4b7
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 4 deletions.
3 changes: 3 additions & 0 deletions docs/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ developers, not a gospel.
api/pulp_smash.config
api/pulp_smash.constants
api/pulp_smash.tests
api/pulp_smash.tests.docker
api/pulp_smash.tests.docker.api_v2
api/pulp_smash.tests.docker.api_v2.test_crud
api/pulp_smash.tests.platform
api/pulp_smash.tests.platform.api_v2
api/pulp_smash.tests.platform.api_v2.test_content_applicability
Expand Down
6 changes: 6 additions & 0 deletions docs/api/pulp_smash.tests.docker.api_v2.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
`pulp_smash.tests.docker.api_v2`
================================

Location: :doc:`/index` → :doc:`/api` → :doc:`/api/pulp_smash.tests.docker.api_v2`

.. automodule:: pulp_smash.tests.docker.api_v2
7 changes: 7 additions & 0 deletions docs/api/pulp_smash.tests.docker.api_v2.test_crud.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
`pulp_smash.tests.docker.api_v2.test_crud`
==========================================

Location: :doc:`/index` → :doc:`/api` →
:doc:`/api/pulp_smash.tests.docker.api_v2.test_crud`

.. automodule:: pulp_smash.tests.docker.api_v2.test_crud
6 changes: 6 additions & 0 deletions docs/api/pulp_smash.tests.docker.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
`pulp_smash.tests.docker`
=========================

Location: :doc:`/index` → :doc:`/api` → :doc:`/api/pulp_smash.tests.docker`

.. automodule:: pulp_smash.tests.docker
11 changes: 7 additions & 4 deletions pulp_smash/tests/docker/api_v2/test_crud.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,23 @@
"""
from __future__ import unicode_literals
import unittest2

import unittest2
from packaging.version import Version
from pulp_smash import config, utils


def _gen_docker_repo_body():
"""Generate a Docker repo create body.
Return a semi-random dict that can be used to create a Docker
repository.
Return a semi-random dict that can be used to create a Docker repository.
"""
return {
'id': utils.uuid4(), 'importer_config': {},
'importer_type_id': 'docker_importer',
'notes': {'_repo-type': 'docker-repo'}}
'notes': {'_repo-type': 'docker-repo'},
}


class _BaseTestCase(unittest2.TestCase):
Expand All @@ -32,6 +33,8 @@ def setUpClass(cls):
"""Provide a server config and an iterable of resources to delete."""
cls.cfg = config.get_config()
cls.attrs_iter = tuple()
if cls.cfg.version < Version('2.8'):
raise unittest2.SkipTest('These tests require at least Pulp 2.8.')

@classmethod
def tearDownClass(cls):
Expand Down

0 comments on commit 668f4b7

Please sign in to comment.