Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions qpc/clicommand.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ def __init__( # noqa: PLR0913
self.req_headers = None
self.response = None

# If you add or change API, you must update these versions
# this includes self.min_server_version
# Minimum server version required by the CLI
self.min_server_version = QPC_MIN_SERVER_VERSION

def _validate_args(self):
Expand Down
1 change: 0 additions & 1 deletion qpc/report/deployments.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ def __init__(self, subparsers):
help=_(messages.REPORT_PATH_HELP),
)
self.report_id = None
self.min_server_version = "0.9.2"

def _validate_args(self): # noqa: PLR0912
CliCommand._validate_args(self)
Expand Down
1 change: 0 additions & 1 deletion qpc/report/details.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ def __init__(self, subparsers):
help=_(messages.REPORT_PATH_HELP),
)
self.report_id = None
self.min_server_version = "0.9.2"

def _validate_args(self): # noqa: PLR0912
CliCommand._validate_args(self)
Expand Down
1 change: 0 additions & 1 deletion qpc/report/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ def __init__(self, subparsers):
help=_(messages.DOWNLOAD_PATH_HELP),
required=True,
)
self.min_server_version = "0.9.2"
self.report_id = None

def _validate_args(self):
Expand Down
2 changes: 0 additions & 2 deletions qpc/report/insights.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@ def __init__(self, subparsers):
metavar="PATH",
help=_(messages.REPORT_PATH_HELP),
)
# Don't change this when you upgrade versions
self.min_server_version = "0.9.0"
self.report_id = None

def _insights_report_available(self, sources):
Expand Down
19 changes: 9 additions & 10 deletions qpc/tests/report/test_report_deployments.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,11 @@

from qpc import messages
from qpc.cli import CLI
from qpc.release import VERSION
from qpc.report import REPORT_URI
from qpc.report.deployments import ReportDeploymentsCommand
from qpc.scan import SCAN_JOB_URI
from qpc.tests.utilities import redirect_stdout
from qpc.utils import create_tar_buffer, get_server_location
from qpc.utils import QPC_MIN_SERVER_VERSION, create_tar_buffer, get_server_location


@pytest.fixture
Expand Down Expand Up @@ -66,7 +65,7 @@ def test_deployments_report_as_json(self, caplog, json_file_path):
get_report_url,
status_code=200,
content=buffer_content,
headers={"X-Server-Version": VERSION},
headers={"X-Server-Version": QPC_MIN_SERVER_VERSION},
)

args = Namespace(
Expand Down Expand Up @@ -95,7 +94,7 @@ def test_deployments_report_as_json_report_id(self, caplog, json_file_path):
get_report_url,
status_code=200,
content=buffer_content,
headers={"X-Server-Version": VERSION},
headers={"X-Server-Version": QPC_MIN_SERVER_VERSION},
)

args = Namespace(
Expand Down Expand Up @@ -126,7 +125,7 @@ def test_deployments_report_as_csv(self, faker, caplog, csv_file_path):
get_report_url,
status_code=200,
content=get_report_response.encode("utf-8"),
headers={"X-Server-Version": VERSION},
headers={"X-Server-Version": QPC_MIN_SERVER_VERSION},
)

args = Namespace(
Expand Down Expand Up @@ -241,7 +240,7 @@ def test_deployments_file_fails_to_write(self, file, caplog, json_file_path):
get_report_url,
status_code=200,
content=buffer_content,
headers={"X-Server-Version": VERSION},
headers={"X-Server-Version": QPC_MIN_SERVER_VERSION},
)

args = Namespace(
Expand Down Expand Up @@ -342,7 +341,7 @@ def test_deployments_report_id_not_exist(self, caplog, json_file_path):
get_report_url,
status_code=400,
content=buffer_content,
headers={"X-Server-Version": VERSION},
headers={"X-Server-Version": QPC_MIN_SERVER_VERSION},
)

args = Namespace(
Expand Down Expand Up @@ -372,7 +371,7 @@ def test_deployments_report_error_scan_job(self, caplog, json_file_path):
get_report_url,
status_code=400,
content=buffer_content,
headers={"X-Server-Version": VERSION},
headers={"X-Server-Version": QPC_MIN_SERVER_VERSION},
)

args = Namespace(
Expand Down Expand Up @@ -411,7 +410,7 @@ def test_deployments_old_version(self, caplog, json_file_path):
with pytest.raises(SystemExit):
self.command.main(args)
err_msg = messages.SERVER_TOO_OLD_FOR_CLI % {
"min_version": "0.9.2",
"min_version": QPC_MIN_SERVER_VERSION,
"current_version": "0.0.45",
}
assert err_msg in caplog.text
Expand All @@ -429,7 +428,7 @@ def test_deployments_report_as_json_no_output_file(caplog, capsys, requests_mock
report_url,
status_code=200,
content=buffer_content,
headers={"X-Server-Version": VERSION},
headers={"X-Server-Version": QPC_MIN_SERVER_VERSION},
)
sys.argv = [
"/bin/qpc",
Expand Down
19 changes: 9 additions & 10 deletions qpc/tests/report/test_report_details.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,11 @@

from qpc import messages
from qpc.cli import CLI
from qpc.release import VERSION
from qpc.report import REPORT_URI
from qpc.report.details import ReportDetailsCommand
from qpc.scan import SCAN_JOB_URI
from qpc.tests.utilities import redirect_stdout
from qpc.utils import create_tar_buffer, get_server_location
from qpc.utils import QPC_MIN_SERVER_VERSION, create_tar_buffer, get_server_location


@pytest.fixture
Expand Down Expand Up @@ -66,7 +65,7 @@ def test_detail_report_as_json(self, caplog, json_file_path):
get_report_url,
status_code=200,
content=buffer_content,
headers={"X-Server-Version": VERSION},
headers={"X-Server-Version": QPC_MIN_SERVER_VERSION},
)

args = Namespace(
Expand Down Expand Up @@ -95,7 +94,7 @@ def test_detail_report_as_json_report_id(self, caplog, json_file_path):
get_report_url,
status_code=200,
content=buffer_content,
headers={"X-Server-Version": VERSION},
headers={"X-Server-Version": QPC_MIN_SERVER_VERSION},
)

args = Namespace(
Expand Down Expand Up @@ -130,7 +129,7 @@ def test_detail_report_as_csv(self, caplog, csv_file_path):
get_report_url,
status_code=200,
json=get_report_csv_data,
headers={"X-Server-Version": VERSION},
headers={"X-Server-Version": QPC_MIN_SERVER_VERSION},
)

args = Namespace(
Expand Down Expand Up @@ -231,7 +230,7 @@ def test_details_file_fails_to_write(self, file, caplog, json_file_path):
get_report_url,
status_code=200,
content=buffer_content,
headers={"X-Server-Version": VERSION},
headers={"X-Server-Version": QPC_MIN_SERVER_VERSION},
)

args = Namespace(
Expand Down Expand Up @@ -330,7 +329,7 @@ def test_details_report_id_not_exist(self, caplog, json_file_path):
get_report_url,
status_code=400,
json=get_report_json_data,
headers={"X-Server-Version": VERSION},
headers={"X-Server-Version": QPC_MIN_SERVER_VERSION},
)

args = Namespace(
Expand Down Expand Up @@ -360,7 +359,7 @@ def test_detail_report_error_scan_job(self, caplog, json_file_path):
get_report_url,
status_code=400,
content=buffer_content,
headers={"X-Server-Version": VERSION},
headers={"X-Server-Version": QPC_MIN_SERVER_VERSION},
)

args = Namespace(
Expand Down Expand Up @@ -399,7 +398,7 @@ def test_details_old_version(self, caplog, csv_file_path):
with pytest.raises(SystemExit):
self.command.main(args)
err_msg = messages.SERVER_TOO_OLD_FOR_CLI % {
"min_version": "0.9.2",
"min_version": QPC_MIN_SERVER_VERSION,
"current_version": "0.0.45",
}
assert err_msg in caplog.text
Expand All @@ -417,7 +416,7 @@ def test_details_report_as_json_no_output_file(caplog, capsys, requests_mock):
report_url,
status_code=200,
content=buffer_content,
headers={"X-Server-Version": VERSION},
headers={"X-Server-Version": QPC_MIN_SERVER_VERSION},
)
sys.argv = [
"/bin/qpc",
Expand Down
15 changes: 7 additions & 8 deletions qpc/tests/report/test_report_download.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,10 @@

from qpc import messages
from qpc.cli import CLI
from qpc.release import VERSION
from qpc.report import REPORT_URI
from qpc.report.download import ReportDownloadCommand
from qpc.scan import SCAN_JOB_URI
from qpc.utils import create_tar_buffer, get_server_location
from qpc.utils import QPC_MIN_SERVER_VERSION, create_tar_buffer, get_server_location


@pytest.fixture
Expand Down Expand Up @@ -56,7 +55,7 @@ def test_download_scan_job(self, caplog, fake_tarball):
mocker.get(
get_report_url,
status_code=200,
headers={"X-Server-Version": VERSION},
headers={"X-Server-Version": QPC_MIN_SERVER_VERSION},
content=buffer_content,
)

Expand All @@ -79,7 +78,7 @@ def test_download_report_id(self, caplog, fake_tarball):
mocker.get(
get_report_url,
status_code=200,
headers={"X-Server-Version": VERSION},
headers={"X-Server-Version": QPC_MIN_SERVER_VERSION},
content=buffer_content,
)

Expand Down Expand Up @@ -184,7 +183,7 @@ def test_file_fails_to_write(self, file, caplog, fake_tarball):
mocker.get(
get_report_url,
status_code=200,
headers={"X-Server-Version": VERSION},
headers={"X-Server-Version": QPC_MIN_SERVER_VERSION},
content=buffer_content,
)

Expand All @@ -206,7 +205,7 @@ def test_download_report_id_not_exist(self, caplog, fake_tarball):
mocker.get(
get_report_url,
status_code=400,
headers={"X-Server-Version": VERSION},
headers={"X-Server-Version": QPC_MIN_SERVER_VERSION},
json=get_report_json_data,
)

Expand Down Expand Up @@ -234,7 +233,7 @@ def test_download_from_server_with_old_version(self, caplog, fake_tarball):
with pytest.raises(SystemExit):
self.command.main(args)
err_msg = messages.SERVER_TOO_OLD_FOR_CLI % {
"min_version": "0.9.2",
"min_version": QPC_MIN_SERVER_VERSION,
"current_version": "0.0.45",
}
assert err_msg in caplog.text
Expand All @@ -249,7 +248,7 @@ def test_download_bad_file_extension(self, caplog, fake_tarball):
mocker.get(
get_report_url,
status_code=200,
headers={"X-Server-Version": VERSION},
headers={"X-Server-Version": QPC_MIN_SERVER_VERSION},
content=buffer_content,
)

Expand Down
Loading