Skip to content

Commit

Permalink
Merge pull request #150 from mdellweg/bindings_tests
Browse files Browse the repository at this point in the history
Bindings tests
  • Loading branch information
Matthias Dellweg committed Feb 19, 2020
2 parents 341f694 + 26f7a91 commit 7c90e1d
Show file tree
Hide file tree
Showing 13 changed files with 709 additions and 426 deletions.
4 changes: 2 additions & 2 deletions flake8.cfg
@@ -1,6 +1,6 @@
[flake8]
exclude = ./docs/*,*/migrations/*
ignore = W503,Q000,D100,D104,D106,D200,D401,D402,D202
ignore = W503,Q000,D100,D104,D106,D200,D401,D402,E203
max-line-length = 100

# Flake8-quotes extension codes
Expand All @@ -16,4 +16,4 @@ max-line-length = 100
# D200: one-line docstring should fit on one line with quotes
# D401: first line should be imperative (nitpicky)
# D402: first line should not be the function’s “signature” (false positives)
# D202: no blank line after docstring--disabled until https://github.com/PyCQA/pydocstyle/issues/361 is fixed
# E203: no whitespace around ':'. disabled until https://github.com/PyCQA/pycodestyle/issues/373 is fixed
2 changes: 1 addition & 1 deletion functest_requirements.txt
@@ -1,2 +1,2 @@
git+https://github.com/PulpQE/pulp-smash.git#egg=pulp-smash
git+https://github.com/pulp/pulp-smash.git#egg=pulp-smash
pytest
6 changes: 1 addition & 5 deletions pulp_deb/app/serializers/content_serializers.py
Expand Up @@ -68,7 +68,6 @@ class GenericContentSerializer(SingleArtifactContentUploadSerializer, ContentChe

def deferred_validate(self, data):
"""Validate the GenericContent data."""

data = super().deferred_validate(data)

data["sha256"] = data["artifact"].sha256
Expand Down Expand Up @@ -389,13 +388,12 @@ def __init__(self, *args, **kwargs):

def deferred_validate(self, data):
"""Validate that the artifact is a package and extract it's values."""

data = super().deferred_validate(data)

try:
package_paragraph = debfile.DebFile(fileobj=data["artifact"].file).debcontrol()
except Exception: # TODO: Be more specific
raise ValidationError(_("Not a valid Deb Package"))
raise ValidationError(_("Unable to read Deb Package"))

from822_serializer = self.Meta.from822_serializer.from822(data=package_paragraph)
from822_serializer.is_valid(raise_exception=True)
Expand Down Expand Up @@ -469,7 +467,6 @@ class PackageSerializer(BasePackageSerializer):

def deferred_validate(self, data):
"""Validate for 'normal' Package (not installer)."""

data = super().deferred_validate(data)

if data.get("section") == "debian-installer":
Expand All @@ -489,7 +486,6 @@ class InstallerPackageSerializer(BasePackageSerializer):

def deferred_validate(self, data):
"""Validate for InstallerPackage."""

data = super().deferred_validate(data)

if data.get("section") != "debian-installer":
Expand Down

0 comments on commit 7c90e1d

Please sign in to comment.