Skip to content

Commit

Permalink
Removes use of django.conf.settings from orphan cleanup tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dkliban committed Nov 10, 2020
1 parent a19b096 commit 185477b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion functest_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
django
dynaconf
pulp-smash
pulp-smash>=1!0.12.0
pulpcore-client
pulp-file-client
pytest
12 changes: 6 additions & 6 deletions pulpcore/tests/functional/api/using_plugin/test_orphans.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@
"""Tests that perform actions over orphan files."""
import os
import unittest
from django.conf import settings
from random import choice

from pulp_smash import cli, config
from pulp_smash import cli, config, utils
from pulp_smash.exceptions import CalledProcessError
from pulp_smash.pulp3.bindings import monitor_task
from pulp_smash.pulp3.constants import MEDIA_PATH
Expand Down Expand Up @@ -52,6 +51,7 @@ def setUpClass(cls):
cls.cfg = config.get_config()
cls.api_client = ApiClient(configuration)
cls.cli_client = cli.Client(cls.cfg)
cls.storage = utils.get_pulp_setting(cls.cli_client, "DEFAULT_FILE_STORAGE")

def test_clean_orphan_content_unit(self):
"""Test whether orphan content units can be clean up.
Expand Down Expand Up @@ -90,7 +90,7 @@ def test_clean_orphan_content_unit(self):

artifacts_api = ArtifactsApi(core_client)

if settings.DEFAULT_FILE_STORAGE == "pulpcore.app.models.storage.FileSystem":
if self.storage == "pulpcore.app.models.storage.FileSystem":
# Verify that the artifact is present on disk.
artifact_path = os.path.join(MEDIA_PATH, artifacts_api.read(content["artifact"]).file)
cmd = ("ls", artifact_path)
Expand All @@ -109,7 +109,7 @@ def test_clean_orphan_content_unit(self):
content_units_href = [c["pulp_href"] for c in content_units]
self.assertNotIn(content["pulp_href"], content_units_href)

if settings.DEFAULT_FILE_STORAGE == "pulpcore.app.models.storage.FileSystem":
if self.storage == "pulpcore.app.models.storage.FileSystem":
# Verify that the artifact was removed from disk.
with self.assertRaises(CalledProcessError):
self.cli_client.run(cmd)
Expand All @@ -123,7 +123,7 @@ def test_clean_orphan_artifact(self):
artifacts_api = ArtifactsApi(core_client)
artifact = artifacts_api.create(file=__file__)

if settings.DEFAULT_FILE_STORAGE == "pulpcore.app.models.storage.FileSystem":
if self.storage == "pulpcore.app.models.storage.FileSystem":
cmd = ("ls", os.path.join(MEDIA_PATH, artifact.file))
self.cli_client.run(cmd, sudo=True)

Expand All @@ -132,6 +132,6 @@ def test_clean_orphan_artifact(self):
with self.assertRaises(ApiException):
artifacts_api.read(artifact.pulp_href)

if settings.DEFAULT_FILE_STORAGE == "pulpcore.app.models.storage.FileSystem":
if self.storage == "pulpcore.app.models.storage.FileSystem":
with self.assertRaises(CalledProcessError):
self.cli_client.run(cmd)

0 comments on commit 185477b

Please sign in to comment.