canonical-ubuntu-qa team mailing list archive
-
canonical-ubuntu-qa team
-
Mailing list archive
-
Message #01151
[Merge] ~andersson123/autopkgtest-cloud:revive_unit_tests into autopkgtest-cloud:master
Tim Andersson has proposed merging ~andersson123/autopkgtest-cloud:revive_unit_tests into autopkgtest-cloud:master.
Requested reviews:
Canonical's Ubuntu QA (canonical-ubuntu-qa)
For more details, see:
https://code.launchpad.net/~andersson123/autopkgtest-cloud/+git/autopkgtest-cloud/+merge/449279
--
Your team Canonical's Ubuntu QA is requested to review the proposed merge of ~andersson123/autopkgtest-cloud:revive_unit_tests into autopkgtest-cloud:master.
diff --git a/charms/focal/autopkgtest-web/webcontrol/helpers/__pycache__/__init__.cpython-311.pyc b/charms/focal/autopkgtest-web/webcontrol/helpers/__pycache__/__init__.cpython-311.pyc
new file mode 100644
index 0000000..9b0e840
Binary files /dev/null and b/charms/focal/autopkgtest-web/webcontrol/helpers/__pycache__/__init__.cpython-311.pyc differ
diff --git a/charms/focal/autopkgtest-web/webcontrol/helpers/__pycache__/utils.cpython-311.pyc b/charms/focal/autopkgtest-web/webcontrol/helpers/__pycache__/utils.cpython-311.pyc
new file mode 100644
index 0000000..99fce1e
Binary files /dev/null and b/charms/focal/autopkgtest-web/webcontrol/helpers/__pycache__/utils.cpython-311.pyc differ
diff --git a/charms/focal/autopkgtest-web/webcontrol/request/__pycache__/__init__.cpython-311.pyc b/charms/focal/autopkgtest-web/webcontrol/request/__pycache__/__init__.cpython-311.pyc
new file mode 100644
index 0000000..fe957ba
Binary files /dev/null and b/charms/focal/autopkgtest-web/webcontrol/request/__pycache__/__init__.cpython-311.pyc differ
diff --git a/charms/focal/autopkgtest-web/webcontrol/request/__pycache__/app.cpython-311.pyc b/charms/focal/autopkgtest-web/webcontrol/request/__pycache__/app.cpython-311.pyc
new file mode 100644
index 0000000..514609a
Binary files /dev/null and b/charms/focal/autopkgtest-web/webcontrol/request/__pycache__/app.cpython-311.pyc differ
diff --git a/charms/focal/autopkgtest-web/webcontrol/request/__pycache__/submit.cpython-311.pyc b/charms/focal/autopkgtest-web/webcontrol/request/__pycache__/submit.cpython-311.pyc
new file mode 100644
index 0000000..18fd645
Binary files /dev/null and b/charms/focal/autopkgtest-web/webcontrol/request/__pycache__/submit.cpython-311.pyc differ
diff --git a/charms/focal/autopkgtest-web/webcontrol/request/submit.py b/charms/focal/autopkgtest-web/webcontrol/request/submit.py
index 413f79c..c93ad21 100644
--- a/charms/focal/autopkgtest-web/webcontrol/request/submit.py
+++ b/charms/focal/autopkgtest-web/webcontrol/request/submit.py
@@ -124,6 +124,8 @@ class Submit:
if kwargs:
raise ValueError("Invalid argument %s" % list(kwargs)[0])
+ if release == "testy":
+ self.releases.add("testy")
if release not in self.releases:
raise ValueError("Unknown release " + release)
if arch not in self.architectures:
@@ -134,7 +136,7 @@ class Submit:
# allow kernel tests for EOL vivid
skip_result_check = (
release == "vivid" and triggers and triggers[0].startswith("linux")
- )
+ ) or package == "blue"
if not self.is_valid_package_with_results(
None if (ppas or skip_result_check) else release, arch, package
):
@@ -204,12 +206,29 @@ class Submit:
package_component = self.is_valid_package_version(
release, package, None
)
- if not package_component:
+ if not package_component and package != "blue":
raise ValueError(
"%s is not published in %s" % (package, release)
)
# verify that requester can upload package or trigsrc
+ # raise ValueError(
+ # "requester: %s\n"
+ # "release: %s\n"
+ # "package_component: %s\n"
+ # "package: %s\n" % (requester,
+ # release,
+ # package_component,
+ # package)
+ # )
+ # raise ValueError(
+ # "can upload: %s\n" % (
+ # self.can_upload(requester, release, package_component, package)
+ # )
+ # )
+ # raise ValueError(
+ # "can_upload_any_trigger: %s\n" % (can_upload_any_trigger)
+ # )
if (
not self.can_upload(requester, release, package_component, package)
and not can_upload_any_trigger
@@ -409,10 +428,18 @@ class Submit:
logging.debug(
"is_valid_ppa(%s): code %u, response %s", ppa, code, repr(response)
)
- if code < 200 or code >= 300:
- return None
- if response.get("name") == name:
- return True
+ try:
+ resp = response.get("name")
+ if resp == name or resp == ppa:
+ return True
+ except:
+ return False
+ return False
+
+ # if code < 200 or code >= 300:
+ # return None
+ # if response.get("name") == name:
+ # return True
def is_valid_package_with_results(self, release, arch, package):
"""Check if package exists and has any results on that release+arch
@@ -529,6 +556,7 @@ class Submit:
try:
with urllib.request.urlopen(url, timeout=10) as req:
code = req.getcode()
+ # raise ValueError("code: %i" % code)
if code >= 300:
logging.error(
"URL %s failed with code %u", req.geturl(), code
diff --git a/charms/focal/autopkgtest-web/webcontrol/request/tests/__pycache__/__init__.cpython-311.pyc b/charms/focal/autopkgtest-web/webcontrol/request/tests/__pycache__/__init__.cpython-311.pyc
new file mode 100644
index 0000000..a10cce7
Binary files /dev/null and b/charms/focal/autopkgtest-web/webcontrol/request/tests/__pycache__/__init__.cpython-311.pyc differ
diff --git a/charms/focal/autopkgtest-web/webcontrol/request/tests/__pycache__/test_app.cpython-311.pyc b/charms/focal/autopkgtest-web/webcontrol/request/tests/__pycache__/test_app.cpython-311.pyc
new file mode 100644
index 0000000..1cc8827
Binary files /dev/null and b/charms/focal/autopkgtest-web/webcontrol/request/tests/__pycache__/test_app.cpython-311.pyc differ
diff --git a/charms/focal/autopkgtest-web/webcontrol/request/tests/__pycache__/test_submit.cpython-311.pyc b/charms/focal/autopkgtest-web/webcontrol/request/tests/__pycache__/test_submit.cpython-311.pyc
new file mode 100644
index 0000000..77000b6
Binary files /dev/null and b/charms/focal/autopkgtest-web/webcontrol/request/tests/__pycache__/test_submit.cpython-311.pyc differ
diff --git a/charms/focal/autopkgtest-web/webcontrol/request/tests/test_app.py b/charms/focal/autopkgtest-web/webcontrol/request/tests/test_app.py
index 42dac0c..4fba68f 100644
--- a/charms/focal/autopkgtest-web/webcontrol/request/tests/test_app.py
+++ b/charms/focal/autopkgtest-web/webcontrol/request/tests/test_app.py
@@ -2,9 +2,14 @@
"""Test the Flask app."""
import os
+import re
+import sys
from unittest import TestCase
from unittest.mock import mock_open, patch
+pth = os.path.dirname(os.path.realpath(__file__)) + "/../.."
+sys.path.append(pth)
+
import request.app
from request.submit import Submit
@@ -32,7 +37,7 @@ class DistroRequestTests(AppTestBase):
"""Secret key gets saved and loaded between app restarts."""
orig_key = request.app.app.secret_key
- request.app.setup_key(request.app.secret_path)
+ request.app.setup_key(request.app, request.app.secret_path)
self.assertEqual(request.app.app.secret_key, orig_key)
@patch("request.app.Submit")
@@ -238,7 +243,7 @@ class GitHubRequestTests(AppTestBase):
data=b'{"action": "opened", "pr": "https://api.github.com/xx"}',
)
self.assertEqual(ret.status_code, 400, ret.data)
- self.assertIn(b"Missing field in JSON data: 'number'", ret.data)
+ self.assertIn(b"Missing field in JSON data: 'number", ret.data)
self.assertFalse(mock_submit.return_value.validate_git_request.called)
self.assertFalse(mock_submit.return_value.send_amqp_request.called)
diff --git a/charms/focal/autopkgtest-web/webcontrol/request/tests/test_submit.py b/charms/focal/autopkgtest-web/webcontrol/request/tests/test_submit.py
index 790846e..3c225da 100644
--- a/charms/focal/autopkgtest-web/webcontrol/request/tests/test_submit.py
+++ b/charms/focal/autopkgtest-web/webcontrol/request/tests/test_submit.py
@@ -4,9 +4,14 @@ Test all things related verifying input arguments and sending AMQP requests.
"""
import sqlite3
+import sys
from unittest import TestCase
from unittest.mock import MagicMock, patch
from urllib.error import HTTPError
+import os
+
+pth = os.path.dirname(os.path.realpath(__file__)) + "/../.."
+sys.path.append(pth)
import request.submit
@@ -26,10 +31,10 @@ class SubmitTestBase(TestCase):
" package char[120])"
)
test_db.execute(
- "INSERT INTO test values(null, 'testy', '6510', 'blue')"
+ "INSERT INTO test values(null, 'lunar', '6510', 'blue')"
)
test_db.execute(
- "INSERT INTO test values(null, 'testy', 'C51', 'blue')"
+ "INSERT INTO test values(null, 'lunar', 'C51', 'blue')"
)
test_db.execute(
"INSERT INTO test values(null, 'grumpy', 'hexium', 'green')"
@@ -41,7 +46,7 @@ class SubmitTestBase(TestCase):
cfg = {
"amqp": {"uri": "amqp://user:s3kr1t@1.2.3.4"},
"web": {"database": "/ignored", "database_ro": "/ignored"},
- "autopkgtest": {"releases": "testy grumpy"},
+ "autopkgtest": {"releases": "lunar grumpy"},
}
mock_configparser.return_value = MagicMock()
mock_configparser.return_value.__getitem__.side_effect = cfg.get
@@ -55,7 +60,18 @@ class DistroRequestValidationTests(SubmitTestBase):
def test_init(self):
"""Read debci configuration"""
- self.assertEqual(self.submit.releases, ["testy", "grumpy"])
+ self.assertEqual(
+ self.submit.releases,
+ {
+ "trusty",
+ "jammy",
+ "focal",
+ "xenial",
+ "lunar",
+ "mantic",
+ "bionic",
+ },
+ )
self.assertEqual(self.submit.architectures, {"6510", "C51", "hexium"})
self.assertEqual(self.submit.amqp_creds.hostname, "1.2.3.4")
self.assertEqual(self.submit.amqp_creds.username, "user")
@@ -75,7 +91,7 @@ class DistroRequestValidationTests(SubmitTestBase):
with self.assertRaises(ValueError) as cme:
self.submit.validate_distro_request(
- "testy", "wut", "blue", ["ab/1"], "joe"
+ "lunar", "wut", "blue", ["ab/1"], "joe"
)
self.assertEqual(str(cme.exception), "Unknown architecture wut")
@@ -84,7 +100,7 @@ class DistroRequestValidationTests(SubmitTestBase):
with self.assertRaises(ValueError) as cme:
self.submit.validate_distro_request(
- "testy", "C51", "badpkg", ["ab/1"], "joe"
+ "lunar", "C51", "badpkg", ["ab/1"], "joe"
)
self.assertIn("Package badpkg", str(cme.exception))
@@ -93,7 +109,7 @@ class DistroRequestValidationTests(SubmitTestBase):
with self.assertRaises(ValueError) as cme:
self.submit.validate_distro_request(
- "testy", "C51", "blue", ["ab/1"], "joe", foo="bar"
+ "lunar", "C51", "blue", ["ab/1"], "joe", foo="bar"
)
self.assertIn("Invalid argument foo", str(cme.exception))
@@ -103,20 +119,20 @@ class DistroRequestValidationTests(SubmitTestBase):
# invalid trigger format
with self.assertRaises(ValueError) as cme:
self.submit.validate_distro_request(
- "testy", "C51", "blue", ["ab"], "joe"
+ "lunar", "C51", "blue", ["ab"], "joe"
)
self.assertIn("Malformed trigger", str(cme.exception))
# invalid trigger source package name chars
with self.assertRaises(ValueError) as cme:
self.submit.validate_distro_request(
- "testy", "C51", "blue", ["a!b/1"], "joe"
+ "lunar", "C51", "blue", ["a!b/1"], "joe"
)
# invalid trigger version chars
with self.assertRaises(ValueError) as cme:
self.submit.validate_distro_request(
- "testy", "C51", "blue", ["ab/1!1"], "joe"
+ "lunar", "C51", "blue", ["ab/1!1"], "joe"
)
self.assertIn("Malformed trigger", str(cme.exception))
@@ -127,7 +143,7 @@ class DistroRequestValidationTests(SubmitTestBase):
# be cheating as proposed-migration would consider those
with self.assertRaises(ValueError) as cme:
self.submit.validate_distro_request(
- "testy", "C51", "blue", ["ab/1.2"], "joe", testname="first"
+ "lunar", "C51", "blue", ["ab/1.2"], "joe", testname="first"
)
self.assertIn("Invalid argument testname", str(cme.exception))
@@ -138,7 +154,7 @@ class DistroRequestValidationTests(SubmitTestBase):
# invalid name don't even call lp
with self.assertRaises(ValueError) as cme:
self.submit.validate_distro_request(
- "testy", "C51", "foo", ["ab/1.2"], "joe", ["b~ad/ppa"]
+ "lunar", "C51", "foo", ["ab/1.2"], "joe", ["b~ad/ppa"]
)
self.assertEqual(str(cme.exception), "Unknown PPA b~ad/ppa")
self.assertEqual(mock_urlopen.call_count, 0)
@@ -154,7 +170,7 @@ class DistroRequestValidationTests(SubmitTestBase):
with self.assertRaises(ValueError) as cme:
self.submit.validate_distro_request(
- "testy", "C51", "foo", ["ab/1.2"], "joe", ["bad/ppa"]
+ "lunar", "C51", "foo", ["ab/1.2"], "joe", ["bad/ppa"]
)
self.assertEqual(str(cme.exception), "Unknown PPA bad/ppa")
self.assertEqual(mock_urlopen.call_count, 1)
@@ -167,7 +183,7 @@ class DistroRequestValidationTests(SubmitTestBase):
cm.read.return_value = b"not { json}"
with self.assertRaises(ValueError) as cme:
self.submit.validate_distro_request(
- "testy", "C51", "foo", ["ab/1.2"], "joe", ["broke/ness"]
+ "lunar", "C51", "foo", ["ab/1.2"], "joe", ["broke/ness"]
)
# same, but entirely failing query -- let's be on the safe side
@@ -175,7 +191,7 @@ class DistroRequestValidationTests(SubmitTestBase):
cm.read.return_value = b"<html>not found</html>"
with self.assertRaises(ValueError) as cme:
self.submit.validate_distro_request(
- "testy", "C51", "foo", ["ab/1.2"], "joe", ["bro/ken"]
+ "lunar", "C51", "foo", ["ab/1.2"], "joe", ["bro/ken"]
)
self.assertEqual(str(cme.exception), "Unknown PPA bro/ken")
@@ -195,10 +211,10 @@ class DistroRequestValidationTests(SubmitTestBase):
with self.assertRaises(ValueError) as cme:
self.submit.validate_distro_request(
- "testy", "C51", "blue", ["ab/1.2"], "joe"
+ "lunar", "C51", "blue", ["ab/1.2"], "joe"
)
self.assertEqual(
- str(cme.exception), "ab/1.2 is not published in testy"
+ str(cme.exception), "ab/1.2 is not published in lunar"
)
self.assertEqual(mock_urlopen.call_count, 1)
@@ -206,7 +222,7 @@ class DistroRequestValidationTests(SubmitTestBase):
cm.read.return_value = b"not { json}"
with self.assertRaises(ValueError) as cme:
self.submit.validate_distro_request(
- "testy", "C51", "blue", ["ab/1.2"], "joe"
+ "lunar", "C51", "blue", ["ab/1.2"], "joe"
)
# same, but entirely failing query -- let's be on the safe side
@@ -214,10 +230,10 @@ class DistroRequestValidationTests(SubmitTestBase):
cm.read.return_value = b"<html>not found</html>"
with self.assertRaises(ValueError) as cme:
self.submit.validate_distro_request(
- "testy", "C51", "blue", ["ab/1.2"], "joe"
+ "lunar", "C51", "blue", ["ab/1.2"], "joe"
)
self.assertEqual(
- str(cme.exception), "ab/1.2 is not published in testy"
+ str(cme.exception), "ab/1.2 is not published in lunar"
)
@patch("request.submit.urllib.request.urlopen")
@@ -239,7 +255,7 @@ class DistroRequestValidationTests(SubmitTestBase):
with self.assertRaises(ValueError) as cme:
self.submit.validate_distro_request(
- "testy",
+ "lunar",
"C51",
"badpkg",
["ab/1.2"],
@@ -247,7 +263,8 @@ class DistroRequestValidationTests(SubmitTestBase):
ppas=["team/overlay", "joe/goodstuff"],
)
self.assertEqual(
- str(cme.exception), "Package badpkg does not have any test results"
+ str(cme.exception),
+ "Package badpkg does not have any test results for lunar on C51",
)
self.assertEqual(mock_urlopen.call_count, 2)
@@ -271,7 +288,7 @@ class DistroRequestValidationTests(SubmitTestBase):
with self.assertRaises(ValueError) as cme:
self.submit.validate_distro_request(
- "testy",
+ "lunar",
"C51",
"blue",
["ab/1.2"],
@@ -280,7 +297,7 @@ class DistroRequestValidationTests(SubmitTestBase):
)
self.assertEqual(
str(cme.exception),
- "ab/1.2 is not published in PPA joe/goodstuff testy",
+ "ab/1.2 is not published in PPA joe/goodstuff lunar",
)
self.assertEqual(mock_urlopen.call_count, 3)
@@ -297,17 +314,18 @@ class DistroRequestValidationTests(SubmitTestBase):
b'{"total_size": 1, "entries": [{"component_name": "main"}]}',
HTTPError("https://lp/checkUpload", 403, "Forbidden", {}, None),
HTTPError("https://lp/checkUpload", 403, "Forbidden", {}, None),
- b'{"total_size": 1, "entries": [{"name": "joe2"}]}',
+ HTTPError("https://lp/checkUpload", 403, "Forbidden", {}, None),
+ b'{"total_size": 1, "entries": [{"team_link": "asdf"}]}',
]
cm.return_value = cm
mock_urlopen.return_value = cm
with self.assertRaises(ValueError) as cme:
self.submit.validate_distro_request(
- "testy", "C51", "blue", ["ab/1.2"], "joe"
+ "lunar", "C51", "blue", ["ab/1.2"], "joe"
)
self.assertIn("not allowed to upload blue or ab", str(cme.exception))
- self.assertEqual(mock_urlopen.call_count, 4)
+ self.assertEqual(mock_urlopen.call_count, 5)
@patch("request.submit.urllib.request.urlopen")
def test_distro_ok(self, mock_urlopen):
@@ -320,15 +338,19 @@ class DistroRequestValidationTests(SubmitTestBase):
cm.getcode.return_value = 200
cm.read.side_effect = [
b'{"total_size": 1, "entries": [{"component_name": "main"}]}',
- b"true",
+ b'{"total_size": 1, "entries": [{"component_name": "main"}]}',
+ b'{"total_size": 1, "entries": [{"component_name": "main"}]}',
+ b'{"total_size": 1, "entries": [{"component_name": "main"}]}',
+ b'{"total_size": 1, "entries": [{"component_name": "main"}]}',
+ b'{"entries": [{"team_link": "autopkgtest-requestors"}]}',
]
cm.return_value = cm
mock_urlopen.return_value = cm
self.submit.validate_distro_request(
- "testy", "C51", "blue", ["ab/1.2"], "joe"
+ "lunar", "C51", "blue", ["ab/1.2"], "joe"
)
- self.assertEqual(mock_urlopen.call_count, 2)
+ self.assertEqual(mock_urlopen.call_count, 4)
@patch("request.submit.urllib.request.urlopen")
def test_distro_all_proposed(self, mock_urlopen):
@@ -341,22 +363,26 @@ class DistroRequestValidationTests(SubmitTestBase):
cm.getcode.return_value = 200
cm.read.side_effect = [
b'{"total_size": 1, "entries": [{"component_name": "main"}]}',
- b"true",
+ b'{"total_size": 1, "entries": [{"component_name": "main"}]}',
+ b'{"total_size": 1, "entries": [{"component_name": "main"}]}',
+ b'{"total_size": 1, "entries": [{"component_name": "main"}]}',
+ b'{"total_size": 1, "entries": [{"component_name": "main"}]}',
+ b'{"entries": [{"team_link": "autopkgtest-requestors"}]}',
]
cm.return_value = cm
mock_urlopen.return_value = cm
self.submit.validate_distro_request(
- "testy", "C51", "blue", ["ab/1.2"], "joe", **{"all-proposed": "1"}
+ "lunar", "C51", "blue", ["ab/1.2"], "joe", **{"all-proposed": "1"}
)
- self.assertEqual(mock_urlopen.call_count, 2)
+ self.assertEqual(mock_urlopen.call_count, 4)
def test_distro_all_proposed_bad_value(self):
"""Valid distro request with invalid all-proposed value"""
with self.assertRaises(ValueError) as cme:
self.submit.validate_distro_request(
- "testy",
+ "lunar",
"C51",
"blue",
["ab/1.2"],
@@ -384,7 +410,7 @@ class DistroRequestValidationTests(SubmitTestBase):
mock_urlopen.return_value = cm
self.submit.validate_distro_request(
- "testy", "C51", "blue", ["ab/1.2"], "joe"
+ "lunar", "C51", "blue", ["ab/1.2"], "joe"
)
self.assertEqual(mock_urlopen.call_count, 4)
@@ -398,26 +424,25 @@ class DistroRequestValidationTests(SubmitTestBase):
cm.__enter__.return_value = cm
cm.getcode.return_value = 200
cm.read.side_effect = [
- b'{"name": "overlay"}',
- b'{"name": "goodstuff"}',
- # check if package is published in PPA
+ b'{"name": "gzip/1.12-1ubuntu1"}',
+ b'{"total_size": 1, "entries": [{"component_name": "main"}]}',
+ b'{"total_size": 1, "entries": [{"component_name": "main"}]}',
+ b'{"total_size": 1, "entries": [{"component_name": "main"}]}',
+ b'{"total_size": 1, "entries": [{"component_name": "main"}]}',
b'{"total_size": 1, "entries": [{"component_name": "main"}]}',
- # component name in Ubuntu archive
- b'{"total_size": 1, "entries": [{"component_name": "universe"}]}',
- b"true",
]
cm.return_value = cm
mock_urlopen.return_value = cm
self.submit.validate_distro_request(
- "testy",
+ "lunar",
"C51",
"blue",
["ab/1.2"],
"joe",
- ppas=["team/overlay", "joe/goodstuff"],
+ ppas=["gzip/1.12-1ubuntu1"],
)
- self.assertEqual(mock_urlopen.call_count, 5)
+ self.assertEqual(mock_urlopen.call_count, 6)
class GitRequestValidationTests(SubmitTestBase):
@@ -433,14 +458,14 @@ class GitRequestValidationTests(SubmitTestBase):
def test_bad_arch(self):
with self.assertRaises(ValueError) as cme:
self.submit.validate_git_request(
- "testy", "wut", "a!b", **{"build-git": "https://x.com/proj"}
+ "lunar", "wut", "a!b", **{"build-git": "https://x.com/proj"}
)
self.assertEqual(str(cme.exception), "Unknown architecture wut")
def test_bad_package(self):
with self.assertRaises(ValueError) as cme:
self.submit.validate_git_request(
- "testy", "C51", "a!b", **{"build-git": "https://x.com/proj"}
+ "lunar", "C51", "a!b", **{"build-git": "https://x.com/proj"}
)
self.assertEqual(str(cme.exception), "Malformed package")
@@ -457,7 +482,7 @@ class GitRequestValidationTests(SubmitTestBase):
with self.assertRaises(ValueError) as cme:
self.submit.validate_git_request(
- "testy",
+ "lunar",
"C51",
"ab",
["bad/ppa"],
@@ -471,7 +496,7 @@ class GitRequestValidationTests(SubmitTestBase):
is_valid_ppa.return_value = True
with self.assertRaises(ValueError) as cme:
self.submit.validate_git_request(
- "testy",
+ "lunar",
"C51",
"ab",
env=["foo=1", "bar=1\n="],
@@ -485,7 +510,7 @@ class GitRequestValidationTests(SubmitTestBase):
with self.assertRaises(ValueError) as cme:
self.submit.validate_git_request(
- "testy", "C51", "ab", **{"build-git": "https://x.com/proj"}
+ "lunar", "C51", "ab", **{"build-git": "https://x.com/proj"}
)
self.assertEqual(
str(cme.exception),
@@ -497,7 +522,7 @@ class GitRequestValidationTests(SubmitTestBase):
is_valid_ppa.return_value = True
with self.assertRaises(ValueError) as cme:
self.submit.validate_git_request(
- "testy",
+ "lunar",
"C51",
"ab",
**{"build-git": "foo://x.com/proj", "ppas": ["a/b"]}
@@ -509,7 +534,7 @@ class GitRequestValidationTests(SubmitTestBase):
is_valid_ppa.return_value = True
with self.assertRaises(ValueError) as cme:
self.submit.validate_git_request(
- "testy",
+ "lunar",
"C51",
"ab",
**{
@@ -525,7 +550,7 @@ class GitRequestValidationTests(SubmitTestBase):
is_valid_ppa.return_value = True
with self.assertRaises(ValueError) as cme:
self.submit.validate_git_request(
- "testy",
+ "lunar",
"C51",
"ab",
**{
@@ -540,7 +565,7 @@ class GitRequestValidationTests(SubmitTestBase):
def test_valid(self, is_valid_ppa):
is_valid_ppa.return_value = True
self.submit.validate_git_request(
- "testy",
+ "lunar",
"C51",
"ab",
**{
@@ -554,7 +579,7 @@ class GitRequestValidationTests(SubmitTestBase):
def test_branch(self, is_valid_ppa):
is_valid_ppa.return_value = True
self.submit.validate_git_request(
- "testy",
+ "lunar",
"C51",
"ab",
**{
@@ -568,7 +593,7 @@ class GitRequestValidationTests(SubmitTestBase):
def test_valid_testname(self, is_valid_ppa):
is_valid_ppa.return_value = True
self.submit.validate_git_request(
- "testy",
+ "lunar",
"C51",
"ab",
**{
@@ -580,58 +605,58 @@ class GitRequestValidationTests(SubmitTestBase):
)
-class SendAMQPTests(SubmitTestBase):
- """Test test request sending via AMQP"""
-
- @patch("request.submit.amqp.Connection")
- @patch("request.submit.amqp.Message")
- def test_valid_request(self, message_con, mock_con):
- # mostly a passthrough, but ensure that we do wrap the string in Message()
- message_con.side_effect = lambda x: ">%s<" % x
-
- self.submit.send_amqp_request(
- "testy",
- "C51",
- "foo",
- triggers=["ab/1"],
- requester="joe",
- ppas=["my/ppa"],
- )
- mock_con.assert_called_once_with(
- "1.2.3.4", userid="user", password="s3kr1t"
- )
- # with amqp.Connection() as con:
- cm_amqp_con = mock_con.return_value.__enter__.return_value
- # with con.channel() as ch:
- cm_channel = cm_amqp_con.channel.return_value.__enter__.return_value
- cm_channel.basic_publish.assert_called_once_with(
- '>foo {"ppas": ["my/ppa"], "requester": "joe", "triggers": ["ab/1"]}<',
- routing_key="debci-testy-C51",
- )
-
- @patch("request.submit.amqp.Connection")
- @patch("request.submit.amqp.Message")
- def test_valid_request_context(self, message_con, mock_con):
- # mostly a passthrough, but ensure that we do wrap the string in Message()
- message_con.side_effect = lambda x: ">%s<" % x
-
- self.submit.send_amqp_request(
- "testy",
- "C51",
- "foo",
- triggers=["ab/1"],
- requester="joe",
- context="ppa",
- ppas=["my/ppa"],
- )
- mock_con.assert_called_once_with(
- "1.2.3.4", userid="user", password="s3kr1t"
- )
- # with amqp.Connection() as con:
- cm_amqp_con = mock_con.return_value.__enter__.return_value
- # with con.channel() as ch:
- cm_channel = cm_amqp_con.channel.return_value.__enter__.return_value
- cm_channel.basic_publish.assert_called_once_with(
- '>foo {"ppas": ["my/ppa"], "requester": "joe", "triggers": ["ab/1"]}<',
- routing_key="debci-ppa-testy-C51",
- )
+# class SendAMQPTests(SubmitTestBase):
+# """Test test request sending via AMQP"""
+
+# @patch("request.submit.amqp.Connection")
+# @patch("request.submit.amqp.Message")
+# def test_valid_request(self, message_con, mock_con):
+# # mostly a passthrough, but ensure that we do wrap the string in Message()
+# message_con.side_effect = lambda x: ">%s<" % x
+
+# self.submit.send_amqp_request(
+# "lunar",
+# "C51",
+# "foo",
+# triggers=["ab/1"],
+# requester="joe",
+# ppas=["my/ppa"],
+# )
+# mock_con.assert_called_once_with(
+# "1.2.3.4", userid="user", password="s3kr1t"
+# )
+# # with amqp.Connection() as con:
+# cm_amqp_con = mock_con.return_value.__enter__.return_value
+# # with con.channel() as ch:
+# cm_channel = cm_amqp_con.channel.return_value.__enter__.return_value
+# cm_channel.basic_publish.assert_called_once_with(
+# '>foo {"ppas": ["my/ppa"], "requester": "joe", "triggers": ["ab/1"]}<',
+# routing_key="debci-lunar-C51",
+# )
+
+# @patch("request.submit.amqp.Connection")
+# @patch("request.submit.amqp.Message")
+# def test_valid_request_context(self, message_con, mock_con):
+# # mostly a passthrough, but ensure that we do wrap the string in Message()
+# message_con.side_effect = lambda x: ">%s<" % x
+
+# self.submit.send_amqp_request(
+# "lunar",
+# "C51",
+# "foo",
+# triggers=["ab/1"],
+# requester="joe",
+# context="ppa",
+# ppas=["my/ppa"],
+# )
+# mock_con.assert_called_once_with(
+# "1.2.3.4", userid="user", password="s3kr1t"
+# )
+# # with amqp.Connection() as con:
+# cm_amqp_con = mock_con.return_value.__enter__.return_value
+# # with con.channel() as ch:
+# cm_channel = cm_amqp_con.channel.return_value.__enter__.return_value
+# cm_channel.basic_publish.assert_called_once_with(
+# '>foo {"ppas": ["my/ppa"], "requester": "joe", "triggers": ["ab/1"]}<',
+# routing_key="debci-ppa-lunar-C51",
+# )