mirror of
https://github.com/quay/quay.git
synced 2025-04-18 10:44:06 +03:00
Enable some flake8 checks in CI (#1389)
This commit is contained in:
parent
73c215ab36
commit
ed8f12ba34
6
.flake8
6
.flake8
@ -1,3 +1,7 @@
|
||||
[flake8]
|
||||
exclude =
|
||||
.*,
|
||||
__pycache__,
|
||||
node_modules
|
||||
max-line-length = 100
|
||||
max-complexity = 10
|
||||
max-complexity = 10
|
||||
|
4
.github/workflows/CI.yaml
vendored
4
.github/workflows/CI.yaml
vendored
@ -35,7 +35,9 @@ jobs:
|
||||
- name: Check Formatting (Flake8)
|
||||
run: |
|
||||
# The code-base needs to be cleaned up. There are too many Flake8
|
||||
# related warnings now. We can at least use it for visibility purposes.
|
||||
# related warnings now. Ignore known problems to catch new ones.
|
||||
flake8 --ignore=C901,E203,E262,E265,E266,E402,E501,E712,E713,E722,E731,E741,F401,F403,F405,F811,F821,F841,W503
|
||||
# Run full scan for visibility purposes.
|
||||
flake8 --exit-zero
|
||||
|
||||
- name: Check Requirements are pinned
|
||||
|
@ -7,6 +7,7 @@ from buildtrigger.test.bitbucketmock import get_bitbucket_trigger
|
||||
from buildtrigger.test.githubmock import get_github_trigger, GithubBuildTrigger
|
||||
from endpoints.building import PreparedBuild
|
||||
|
||||
|
||||
# Note: This test suite executes a common set of tests against all the trigger types specified
|
||||
# in this fixture. Each trigger's mock is expected to return the same data for all of these calls.
|
||||
@pytest.fixture(params=[get_github_trigger(), get_bitbucket_trigger()])
|
||||
|
@ -19,7 +19,7 @@ def get_channel_releases(repo, channel, models_ref):
|
||||
Channel.repository == repo,
|
||||
Channel.name == channel_name,
|
||||
Channel.tag_kind == tag_kind_id,
|
||||
Channel.lifetime_end != None,
|
||||
Channel.lifetime_end.is_null(False),
|
||||
)
|
||||
.order_by(Tag.lifetime_end)
|
||||
)
|
||||
|
@ -292,16 +292,16 @@ def upgrade(op, tables, tester):
|
||||
|
||||
# OAuthApplication
|
||||
logger.info("Backfilling secret for OAuth applications")
|
||||
for app in _iterate(OAuthApplication, OAuthApplication.fully_migrated == False):
|
||||
logger.info("Backfilling secret for OAuth application %s", app.id)
|
||||
client_secret = app.client_secret or str(uuid.uuid4())
|
||||
for oapp in _iterate(OAuthApplication, OAuthApplication.fully_migrated == False):
|
||||
logger.info("Backfilling secret for OAuth application %s", oapp.id)
|
||||
client_secret = oapp.client_secret or str(uuid.uuid4())
|
||||
secure_client_secret = _decrypted(client_secret)
|
||||
|
||||
(
|
||||
OAuthApplication.update(
|
||||
secure_client_secret=secure_client_secret, fully_migrated=True
|
||||
)
|
||||
.where(OAuthApplication.id == app.id, OAuthApplication.fully_migrated == False)
|
||||
.where(OAuthApplication.id == oapp.id, OAuthApplication.fully_migrated == False)
|
||||
.execute()
|
||||
)
|
||||
|
||||
|
@ -945,7 +945,7 @@ def _get_matching_users(
|
||||
self.robot = args[3]
|
||||
|
||||
if organization:
|
||||
self.is_org_member = args[3] != None
|
||||
self.is_org_member = args[3] is not None
|
||||
else:
|
||||
self.is_org_member = None
|
||||
|
||||
|
@ -7,14 +7,14 @@ from image.docker.schema2 import (
|
||||
PYTHON_BULLSEYE = {
|
||||
"content-type": DOCKER_SCHEMA2_MANIFESTLIST_CONTENT_TYPE,
|
||||
"digest": "sha256:90213d7c778e0c59de4420925fc35ff76d8d91f6b0ddcf16789af05b78ddc779",
|
||||
"manifest": '{"manifests":[{"digest":"sha256:ec43d739179d1979274d05ac081e279c97cfe5ca31777b7de3ec77ff82909073","mediaType":"application\/vnd.docker.distribution.manifest.v2+json","platform":{"architecture":"amd64","os":"linux"},"size":2218},{"digest":"sha256:7f2fa3897549ad7a3b64353c5f7bf61021d22ec4073137804660d1aa3b3143ac","mediaType":"application\/vnd.docker.distribution.manifest.v2+json","platform":{"architecture":"arm","os":"linux","variant":"v5"},"size":2218},{"digest":"sha256:4dd7b7c5bfc1ca08ddd4b0707278afc4859ff879438c4835b3cec7eb5e85a9ee","mediaType":"application\/vnd.docker.distribution.manifest.v2+json","platform":{"architecture":"arm","os":"linux","variant":"v7"},"size":2218},{"digest":"sha256:80f1f8bcde1cf3b5b9a6b1ade3c90233f2738f5c0685685bdcccde311530caa8","mediaType":"application\/vnd.docker.distribution.manifest.v2+json","platform":{"architecture":"arm64","os":"linux","variant":"v8"},"size":2218},{"digest":"sha256:f501c3f975948f1ee60a5261efbb156abbcdd01c193bae1bbcffa6a2f2d8cb5d","mediaType":"application\/vnd.docker.distribution.manifest.v2+json","platform":{"architecture":"386","os":"linux"},"size":2218},{"digest":"sha256:4f5c4c677c87e98f00b8affef87651f65c258c9b4b53ba4b237ac7f7668cac4e","mediaType":"application\/vnd.docker.distribution.manifest.v2+json","platform":{"architecture":"mips64le","os":"linux"},"size":2218},{"digest":"sha256:f3fb8be68a0eb71df0c54c0b8cb7aa192934ac7becb4cf2ac4142c925c3cbfdd","mediaType":"application\/vnd.docker.distribution.manifest.v2+json","platform":{"architecture":"ppc64le","os":"linux"},"size":2218},{"digest":"sha256:969d7a3a04292e2f54c79f24f56ad520e4b355eaa2066420b63928337c22109d","mediaType":"application\/vnd.docker.distribution.manifest.v2+json","platform":{"architecture":"s390x","os":"linux"},"size":2218}],"mediaType":"application\/vnd.docker.distribution.manifest.list.v2+json","schemaVersion":2}',
|
||||
"manifest": '{"manifests":[{"digest":"sha256:ec43d739179d1979274d05ac081e279c97cfe5ca31777b7de3ec77ff82909073","mediaType":"application\\/vnd.docker.distribution.manifest.v2+json","platform":{"architecture":"amd64","os":"linux"},"size":2218},{"digest":"sha256:7f2fa3897549ad7a3b64353c5f7bf61021d22ec4073137804660d1aa3b3143ac","mediaType":"application\\/vnd.docker.distribution.manifest.v2+json","platform":{"architecture":"arm","os":"linux","variant":"v5"},"size":2218},{"digest":"sha256:4dd7b7c5bfc1ca08ddd4b0707278afc4859ff879438c4835b3cec7eb5e85a9ee","mediaType":"application\\/vnd.docker.distribution.manifest.v2+json","platform":{"architecture":"arm","os":"linux","variant":"v7"},"size":2218},{"digest":"sha256:80f1f8bcde1cf3b5b9a6b1ade3c90233f2738f5c0685685bdcccde311530caa8","mediaType":"application\\/vnd.docker.distribution.manifest.v2+json","platform":{"architecture":"arm64","os":"linux","variant":"v8"},"size":2218},{"digest":"sha256:f501c3f975948f1ee60a5261efbb156abbcdd01c193bae1bbcffa6a2f2d8cb5d","mediaType":"application\\/vnd.docker.distribution.manifest.v2+json","platform":{"architecture":"386","os":"linux"},"size":2218},{"digest":"sha256:4f5c4c677c87e98f00b8affef87651f65c258c9b4b53ba4b237ac7f7668cac4e","mediaType":"application\\/vnd.docker.distribution.manifest.v2+json","platform":{"architecture":"mips64le","os":"linux"},"size":2218},{"digest":"sha256:f3fb8be68a0eb71df0c54c0b8cb7aa192934ac7becb4cf2ac4142c925c3cbfdd","mediaType":"application\\/vnd.docker.distribution.manifest.v2+json","platform":{"architecture":"ppc64le","os":"linux"},"size":2218},{"digest":"sha256:969d7a3a04292e2f54c79f24f56ad520e4b355eaa2066420b63928337c22109d","mediaType":"application\\/vnd.docker.distribution.manifest.v2+json","platform":{"architecture":"s390x","os":"linux"},"size":2218}],"mediaType":"application\\/vnd.docker.distribution.manifest.list.v2+json","schemaVersion":2}',
|
||||
}
|
||||
|
||||
# docker.io/library/python:latest
|
||||
PYTHON_LATEST = {
|
||||
"content-type": DOCKER_SCHEMA2_MANIFESTLIST_CONTENT_TYPE,
|
||||
"digest": "sha256:567018293e51a89db96ce4c9679fdefc89b3d17a9fe9e94c0091b04ac5bb4e89",
|
||||
"manifest": '{"manifests":[{"digest":"sha256:ec43d739179d1979274d05ac081e279c97cfe5ca31777b7de3ec77ff82909073","mediaType":"application\/vnd.docker.distribution.manifest.v2+json","platform":{"architecture":"amd64","os":"linux"},"size":2218},{"digest":"sha256:7f2fa3897549ad7a3b64353c5f7bf61021d22ec4073137804660d1aa3b3143ac","mediaType":"application\/vnd.docker.distribution.manifest.v2+json","platform":{"architecture":"arm","os":"linux","variant":"v5"},"size":2218},{"digest":"sha256:4dd7b7c5bfc1ca08ddd4b0707278afc4859ff879438c4835b3cec7eb5e85a9ee","mediaType":"application\/vnd.docker.distribution.manifest.v2+json","platform":{"architecture":"arm","os":"linux","variant":"v7"},"size":2218},{"digest":"sha256:80f1f8bcde1cf3b5b9a6b1ade3c90233f2738f5c0685685bdcccde311530caa8","mediaType":"application\/vnd.docker.distribution.manifest.v2+json","platform":{"architecture":"arm64","os":"linux","variant":"v8"},"size":2218},{"digest":"sha256:f501c3f975948f1ee60a5261efbb156abbcdd01c193bae1bbcffa6a2f2d8cb5d","mediaType":"application\/vnd.docker.distribution.manifest.v2+json","platform":{"architecture":"386","os":"linux"},"size":2218},{"digest":"sha256:4f5c4c677c87e98f00b8affef87651f65c258c9b4b53ba4b237ac7f7668cac4e","mediaType":"application\/vnd.docker.distribution.manifest.v2+json","platform":{"architecture":"mips64le","os":"linux"},"size":2218},{"digest":"sha256:f3fb8be68a0eb71df0c54c0b8cb7aa192934ac7becb4cf2ac4142c925c3cbfdd","mediaType":"application\/vnd.docker.distribution.manifest.v2+json","platform":{"architecture":"ppc64le","os":"linux"},"size":2218},{"digest":"sha256:969d7a3a04292e2f54c79f24f56ad520e4b355eaa2066420b63928337c22109d","mediaType":"application\/vnd.docker.distribution.manifest.v2+json","platform":{"architecture":"s390x","os":"linux"},"size":2218},{"digest":"sha256:0e9e7fb64430afaa195198b26548c82d6e4e8a0fddd726f0f8213abf99f8528e","mediaType":"application\/vnd.docker.distribution.manifest.v2+json","platform":{"architecture":"amd64","os":"windows","os.version":"10.0.20348.707"},"size":3189},{"digest":"sha256:28a844614587f4594626999fe4193dcfc68a9f37fbc688f9af704016f3d53fa1","mediaType":"application\/vnd.docker.distribution.manifest.v2+json","platform":{"architecture":"amd64","os":"windows","os.version":"10.0.17763.2928"},"size":3189}],"mediaType":"application\/vnd.docker.distribution.manifest.list.v2+json","schemaVersion":2}',
|
||||
"manifest": '{"manifests":[{"digest":"sha256:ec43d739179d1979274d05ac081e279c97cfe5ca31777b7de3ec77ff82909073","mediaType":"application\\/vnd.docker.distribution.manifest.v2+json","platform":{"architecture":"amd64","os":"linux"},"size":2218},{"digest":"sha256:7f2fa3897549ad7a3b64353c5f7bf61021d22ec4073137804660d1aa3b3143ac","mediaType":"application\\/vnd.docker.distribution.manifest.v2+json","platform":{"architecture":"arm","os":"linux","variant":"v5"},"size":2218},{"digest":"sha256:4dd7b7c5bfc1ca08ddd4b0707278afc4859ff879438c4835b3cec7eb5e85a9ee","mediaType":"application\\/vnd.docker.distribution.manifest.v2+json","platform":{"architecture":"arm","os":"linux","variant":"v7"},"size":2218},{"digest":"sha256:80f1f8bcde1cf3b5b9a6b1ade3c90233f2738f5c0685685bdcccde311530caa8","mediaType":"application\\/vnd.docker.distribution.manifest.v2+json","platform":{"architecture":"arm64","os":"linux","variant":"v8"},"size":2218},{"digest":"sha256:f501c3f975948f1ee60a5261efbb156abbcdd01c193bae1bbcffa6a2f2d8cb5d","mediaType":"application\\/vnd.docker.distribution.manifest.v2+json","platform":{"architecture":"386","os":"linux"},"size":2218},{"digest":"sha256:4f5c4c677c87e98f00b8affef87651f65c258c9b4b53ba4b237ac7f7668cac4e","mediaType":"application\\/vnd.docker.distribution.manifest.v2+json","platform":{"architecture":"mips64le","os":"linux"},"size":2218},{"digest":"sha256:f3fb8be68a0eb71df0c54c0b8cb7aa192934ac7becb4cf2ac4142c925c3cbfdd","mediaType":"application\\/vnd.docker.distribution.manifest.v2+json","platform":{"architecture":"ppc64le","os":"linux"},"size":2218},{"digest":"sha256:969d7a3a04292e2f54c79f24f56ad520e4b355eaa2066420b63928337c22109d","mediaType":"application\\/vnd.docker.distribution.manifest.v2+json","platform":{"architecture":"s390x","os":"linux"},"size":2218},{"digest":"sha256:0e9e7fb64430afaa195198b26548c82d6e4e8a0fddd726f0f8213abf99f8528e","mediaType":"application\\/vnd.docker.distribution.manifest.v2+json","platform":{"architecture":"amd64","os":"windows","os.version":"10.0.20348.707"},"size":3189},{"digest":"sha256:28a844614587f4594626999fe4193dcfc68a9f37fbc688f9af704016f3d53fa1","mediaType":"application\\/vnd.docker.distribution.manifest.v2+json","platform":{"architecture":"amd64","os":"windows","os.version":"10.0.17763.2928"},"size":3189}],"mediaType":"application\\/vnd.docker.distribution.manifest.list.v2+json","schemaVersion":2}',
|
||||
}
|
||||
|
||||
# docker.io/library/python@sha256:ec43d739179d1979274d05ac081e279c97cfe5ca31777b7de3ec77ff82909073
|
||||
|
@ -58,7 +58,6 @@ common_properties = {
|
||||
},
|
||||
"root_rule": {
|
||||
"type": "object",
|
||||
"description": "Tag mirror rule",
|
||||
"required": ["rule_kind", "rule_value"],
|
||||
"properties": {
|
||||
"rule_kind": {
|
||||
|
@ -1,5 +1,7 @@
|
||||
import logging
|
||||
import urllib.request, urllib.error, urllib.parse
|
||||
import urllib.request
|
||||
import urllib.error
|
||||
import urllib.parse
|
||||
import re
|
||||
import os
|
||||
import hashlib
|
||||
|
@ -1,3 +1,4 @@
|
||||
import hashlib
|
||||
import json
|
||||
import pytest
|
||||
|
||||
@ -36,9 +37,9 @@ CONFIG_BYTES = json.dumps(
|
||||
"OpenStdin": False,
|
||||
"StdinOnce": False,
|
||||
"Env": [
|
||||
"HTTP_PROXY=http:\/\/localhost:8080",
|
||||
"http_proxy=http:\/\/localhost:8080",
|
||||
"PATH=\/usr\/local\/sbin:\/usr\/local\/bin:\/usr\/sbin:\/usr\/bin:\/sbin:\/bin",
|
||||
"HTTP_PROXY=http://localhost:8080",
|
||||
"http_proxy=http://localhost:8080",
|
||||
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
|
||||
],
|
||||
"Cmd": ["sh"],
|
||||
"Image": "",
|
||||
@ -60,12 +61,12 @@ CONFIG_BYTES = json.dumps(
|
||||
"OpenStdin": True,
|
||||
"StdinOnce": True,
|
||||
"Env": [
|
||||
"HTTP_PROXY=http:\/\/localhost:8080",
|
||||
"http_proxy=http:\/\/localhost:8080",
|
||||
"PATH=\/usr\/local\/sbin:\/usr\/local\/bin:\/usr\/sbin:\/usr\/bin:\/sbin:\/bin",
|
||||
"HTTP_PROXY=http://localhost:8080",
|
||||
"http_proxy=http://localhost:8080",
|
||||
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
|
||||
],
|
||||
"Cmd": ["sh"],
|
||||
"Image": "jschorr\/somerepo",
|
||||
"Image": "jschorr/somerepo",
|
||||
"Volumes": None,
|
||||
"WorkingDir": "",
|
||||
"Entrypoint": None,
|
||||
@ -77,7 +78,7 @@ CONFIG_BYTES = json.dumps(
|
||||
"history": [
|
||||
{
|
||||
"created": "2018-04-03T18:37:09.284840891Z",
|
||||
"created_by": "\/bin\/sh -c #(nop) ADD file:9e4ca21cbd24dc05b454b6be21c7c639216ae66559b21ba24af0d665c62620dc in \/ ",
|
||||
"created_by": "/bin/sh -c #(nop) ADD file:9e4ca21cbd24dc05b454b6be21c7c639216ae66559b21ba24af0d665c62620dc in / ",
|
||||
},
|
||||
{
|
||||
"created": "2018-04-03T18:37:09.613317719Z",
|
||||
@ -97,7 +98,9 @@ CONFIG_BYTES = json.dumps(
|
||||
],
|
||||
},
|
||||
}
|
||||
)
|
||||
).encode("utf-8")
|
||||
CONFIG_SIZE = len(CONFIG_BYTES)
|
||||
CONFIG_DIGEST = "sha256:" + hashlib.sha256(CONFIG_BYTES).hexdigest()
|
||||
|
||||
|
||||
def test_valid_config():
|
||||
|
@ -17,7 +17,7 @@ from image.docker.schema2.manifest import (
|
||||
EMPTY_LAYER_BLOB_DIGEST,
|
||||
)
|
||||
from image.docker.schema2.config import DockerSchema2Config
|
||||
from image.docker.schema2.test.test_config import CONFIG_BYTES
|
||||
from image.docker.schema2.test.test_config import CONFIG_BYTES, CONFIG_SIZE, CONFIG_DIGEST
|
||||
from image.shared.schemautil import ContentRetrieverForTesting
|
||||
from util.bytes import Bytes
|
||||
|
||||
@ -45,8 +45,8 @@ MANIFEST_BYTES = json.dumps(
|
||||
"mediaType": "application/vnd.docker.distribution.manifest.v2+json",
|
||||
"config": {
|
||||
"mediaType": "application/vnd.docker.container.image.v1+json",
|
||||
"size": 1885,
|
||||
"digest": "sha256:b5b2b2c507a0944348e0303114d8d93aaaa081732b86451d9bce1f432a537bc7",
|
||||
"size": CONFIG_SIZE,
|
||||
"digest": CONFIG_DIGEST,
|
||||
},
|
||||
"layers": [
|
||||
{
|
||||
@ -79,8 +79,8 @@ REMOTE_MANIFEST_BYTES = json.dumps(
|
||||
"mediaType": "application/vnd.docker.distribution.manifest.v2+json",
|
||||
"config": {
|
||||
"mediaType": "application/vnd.docker.container.image.v1+json",
|
||||
"size": 1885,
|
||||
"digest": "sha256:b5b2b2c507a0944348e0303114d8d93aaaa081732b86451d9bce1f432a537bc7",
|
||||
"size": CONFIG_SIZE,
|
||||
"digest": CONFIG_DIGEST,
|
||||
},
|
||||
"layers": [
|
||||
{
|
||||
@ -111,11 +111,8 @@ REMOTE_MANIFEST_BYTES = json.dumps(
|
||||
|
||||
def test_valid_manifest():
|
||||
manifest = DockerSchema2Manifest(Bytes.for_string_or_unicode(MANIFEST_BYTES))
|
||||
assert manifest.config.size == 1885
|
||||
assert (
|
||||
str(manifest.config.digest)
|
||||
== "sha256:b5b2b2c507a0944348e0303114d8d93aaaa081732b86451d9bce1f432a537bc7"
|
||||
)
|
||||
assert manifest.config.size == CONFIG_SIZE
|
||||
assert str(manifest.config.digest) == CONFIG_DIGEST
|
||||
assert manifest.media_type == "application/vnd.docker.distribution.manifest.v2+json"
|
||||
assert not manifest.has_remote_layer
|
||||
assert manifest.has_legacy_image
|
||||
@ -135,8 +132,8 @@ def test_valid_manifest():
|
||||
{"created": "2018-04-12T18:37:09.284840891Z", "created_by": "bar"},
|
||||
],
|
||||
},
|
||||
"sha256:b5b2b2c507a0944348e0303114d8d93aaaa081732b86451d9bce1f432a537bc7",
|
||||
1885,
|
||||
CONFIG_DIGEST,
|
||||
CONFIG_SIZE,
|
||||
)
|
||||
|
||||
assert len(manifest.filesystem_layers) == 4
|
||||
@ -168,11 +165,8 @@ def test_valid_manifest():
|
||||
|
||||
def test_valid_remote_manifest():
|
||||
manifest = DockerSchema2Manifest(Bytes.for_string_or_unicode(REMOTE_MANIFEST_BYTES))
|
||||
assert manifest.config.size == 1885
|
||||
assert (
|
||||
str(manifest.config.digest)
|
||||
== "sha256:b5b2b2c507a0944348e0303114d8d93aaaa081732b86451d9bce1f432a537bc7"
|
||||
)
|
||||
assert manifest.config.size == CONFIG_SIZE
|
||||
assert str(manifest.config.digest) == CONFIG_DIGEST
|
||||
assert manifest.media_type == "application/vnd.docker.distribution.manifest.v2+json"
|
||||
assert manifest.has_remote_layer
|
||||
assert manifest.config_media_type == "application/vnd.docker.container.image.v1+json"
|
||||
@ -218,8 +212,8 @@ def test_valid_remote_manifest():
|
||||
{"created": "2018-04-12T18:37:09.284840891Z", "created_by": "bar"},
|
||||
],
|
||||
},
|
||||
"sha256:b5b2b2c507a0944348e0303114d8d93aaaa081732b86451d9bce1f432a537bc7",
|
||||
1885,
|
||||
CONFIG_DIGEST,
|
||||
CONFIG_SIZE,
|
||||
)
|
||||
|
||||
manifest_image_layers = list(manifest.get_layers(retriever))
|
||||
@ -254,8 +248,8 @@ def test_get_manifest_labels():
|
||||
"rootfs": {"type": "layers", "diff_ids": []},
|
||||
"history": [],
|
||||
},
|
||||
"sha256:b5b2b2c507a0944348e0303114d8d93aaaa081732b86451d9bce1f432a537bc7",
|
||||
1885,
|
||||
CONFIG_DIGEST,
|
||||
CONFIG_SIZE,
|
||||
)
|
||||
|
||||
manifest = DockerSchema2Manifest(Bytes.for_string_or_unicode(MANIFEST_BYTES))
|
||||
@ -268,7 +262,7 @@ def test_build_schema1():
|
||||
|
||||
retriever = ContentRetrieverForTesting(
|
||||
{
|
||||
"sha256:b5b2b2c507a0944348e0303114d8d93aaaa081732b86451d9bce1f432a537bc7": CONFIG_BYTES,
|
||||
CONFIG_DIGEST: CONFIG_BYTES,
|
||||
}
|
||||
)
|
||||
|
||||
@ -293,8 +287,8 @@ def test_get_schema1_manifest():
|
||||
{"created": "2018-04-12T18:37:09.284840891Z", "created_by": "bar"},
|
||||
],
|
||||
},
|
||||
"sha256:b5b2b2c507a0944348e0303114d8d93aaaa081732b86451d9bce1f432a537bc7",
|
||||
1885,
|
||||
CONFIG_DIGEST,
|
||||
CONFIG_SIZE,
|
||||
)
|
||||
|
||||
manifest = DockerSchema2Manifest(Bytes.for_string_or_unicode(MANIFEST_BYTES))
|
||||
|
@ -2,8 +2,9 @@ import copy
|
||||
import logging
|
||||
import requests
|
||||
import time
|
||||
import urllib.request, urllib.parse, urllib.error
|
||||
import urllib.request
|
||||
import urllib.parse
|
||||
import urllib.error
|
||||
|
||||
from abc import ABCMeta, abstractmethod
|
||||
from six import add_metaclass
|
||||
|
@ -54,5 +54,5 @@ class SecurityScannerValidator(BaseValidator):
|
||||
message = str(last_exception)
|
||||
raise ConfigValidationException("Could not ping security scanner: %s" % message)
|
||||
elif not response.get("state"):
|
||||
message = "Invalid indexer state" % (response.status_code, response.text)
|
||||
message = "Invalid indexer state"
|
||||
raise ConfigValidationException("Could not ping security scanner: %s" % message)
|
||||
|
@ -2,6 +2,7 @@ from smtplib import SMTPException
|
||||
from smtplib import SMTPAuthenticationError
|
||||
from smtplib import SMTPNotSupportedError
|
||||
|
||||
|
||||
# This method is the same as smtplib.SMTP.login except that CRAM_MD5 has been removed from preferred auths since MD5 is not FIPS compliant.
|
||||
def login_fips_safe(self, user, password, *, initial_response_ok=True):
|
||||
"""Log in on an SMTP server that requires authentication.
|
||||
|
@ -1,5 +1,6 @@
|
||||
from itertools import islice
|
||||
|
||||
|
||||
# From: https://docs.python.org/2/library/itertools.html
|
||||
def take(n, iterable):
|
||||
"""
|
||||
|
@ -5,7 +5,9 @@ import sys
|
||||
import threading
|
||||
import time
|
||||
from collections import namedtuple
|
||||
import urllib.request, urllib.error, urllib.parse
|
||||
import urllib.request
|
||||
import urllib.error
|
||||
import urllib.parse
|
||||
|
||||
from cachetools.func import lru_cache
|
||||
|
||||
|
@ -1,4 +1,6 @@
|
||||
import urllib.request, urllib.parse, urllib.error
|
||||
import urllib.request
|
||||
import urllib.parse
|
||||
import urllib.error
|
||||
import re
|
||||
|
||||
from text_unidecode import unidecode
|
||||
|
@ -111,7 +111,7 @@ def test_none_read():
|
||||
return None
|
||||
|
||||
stream = StreamSlice(NoneReader(), 0)
|
||||
assert stream.read(-1) == None
|
||||
assert stream.read(-1) is None
|
||||
assert stream.tell() == 0
|
||||
|
||||
|
||||
|
@ -220,8 +220,8 @@ def test_get_metadata_exception(connection_error, response_code, exception):
|
||||
client.request.side_effect = exception
|
||||
tuf_api = api.TUFMetadataAPI(app, app.config, client=client)
|
||||
tags, expiration = tuf_api.get_default_tags_with_expiration("quay", "quay")
|
||||
assert tags == None
|
||||
assert expiration == None
|
||||
assert tags is None
|
||||
assert expiration is None
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
|
Loading…
x
Reference in New Issue
Block a user