| |
@@ -9,7 +9,7 @@
|
| |
|
| |
class TestFlagCIPRToddler:
|
| |
def test_accepts_topic_invalid(self):
|
| |
- assert toddlers.plugins.flag_ci_pr.FlagCIPR.accepts_topic("foo.bar") == False
|
| |
+ assert toddlers.plugins.flag_ci_pr.FlagCIPR.accepts_topic("foo.bar") is False
|
| |
|
| |
@pytest.mark.parametrize(
|
| |
"topic",
|
| |
@@ -26,14 +26,14 @@
|
| |
],
|
| |
)
|
| |
def test_accepts_topic_valid(self, topic):
|
| |
- assert toddlers.plugins.flag_ci_pr.FlagCIPR.accepts_topic(topic) == True
|
| |
+ assert toddlers.plugins.flag_ci_pr.FlagCIPR.accepts_topic(topic)
|
| |
|
| |
def test_process_invalid(self):
|
| |
msg = fedora_messaging.api.Message()
|
| |
msg.id = 123
|
| |
msg.topic = "toddlers.test.topic"
|
| |
assert (
|
| |
- toddlers.plugins.flag_ci_pr.FlagCIPR.process(config={}, message=msg) == None
|
| |
+ toddlers.plugins.flag_ci_pr.FlagCIPR.process(config={}, message=msg) is None
|
| |
)
|
| |
|
| |
def test_process_invalid_status(self, caplog):
|
| |
@@ -42,7 +42,7 @@
|
| |
msg.id = 123
|
| |
msg.topic = "org.centos.stg.ci.dist-git-pr.test.invalid"
|
| |
assert (
|
| |
- toddlers.plugins.flag_ci_pr.FlagCIPR.process(config={}, message=msg) == None
|
| |
+ toddlers.plugins.flag_ci_pr.FlagCIPR.process(config={}, message=msg) is None
|
| |
)
|
| |
assert (
|
| |
caplog.records[-1].message
|
| |
@@ -55,7 +55,7 @@
|
| |
msg.id = 123
|
| |
msg.topic = "org.centos.stg.ci.dist-git-pr.test.complete"
|
| |
assert (
|
| |
- toddlers.plugins.flag_ci_pr.FlagCIPR.process(config={}, message=msg) == None
|
| |
+ toddlers.plugins.flag_ci_pr.FlagCIPR.process(config={}, message=msg) is None
|
| |
)
|
| |
assert caplog.records[-1].message == "Unsupported msg version, ignoring"
|
| |
|
| |
@@ -64,9 +64,9 @@
|
| |
msg = fedora_messaging.api.Message()
|
| |
msg.id = 123
|
| |
msg.topic = "org.centos.stg.ci.dist-git-pr.test.complete"
|
| |
- msg.body = {"version": "0.2.1", "test": {"result": "invalid",}}
|
| |
+ msg.body = {"version": "0.2.1", "test": {"result": "invalid"}}
|
| |
assert (
|
| |
- toddlers.plugins.flag_ci_pr.FlagCIPR.process(config={}, message=msg) == None
|
| |
+ toddlers.plugins.flag_ci_pr.FlagCIPR.process(config={}, message=msg) is None
|
| |
)
|
| |
assert (
|
| |
caplog.records[-1].message
|
| |
@@ -80,15 +80,16 @@
|
| |
msg.topic = "org.centos.stg.ci.dist-git-pr.test.complete"
|
| |
msg.body = {
|
| |
"version": "0.2.1",
|
| |
- "test": {"result": "passed",},
|
| |
- "artifact": {"commit_hash": "abcdefghijklmnopqrst",},
|
| |
+ "test": {"result": "passed"},
|
| |
+ "artifact": {"commit_hash": "abcdefghijklmnopqrst"},
|
| |
}
|
| |
assert (
|
| |
- toddlers.plugins.flag_ci_pr.FlagCIPR.process(config={}, message=msg) == None
|
| |
+ toddlers.plugins.flag_ci_pr.FlagCIPR.process(config={}, message=msg) is None
|
| |
)
|
| |
assert (
|
| |
caplog.records[-1].message
|
| |
- == "Invalid message: {'commit_hash': 'abcdefghijklmnopqrst'}, could not extract the PR id from it"
|
| |
+ == "Invalid message: {'commit_hash': 'abcdefghijklmnopqrst'}, could not extract "
|
| |
+ "the PR id from it"
|
| |
)
|
| |
|
| |
@patch("toddlers.plugins.flag_ci_pr.requests_session")
|
| |
@@ -102,13 +103,13 @@
|
| |
msg.topic = "org.centos.stg.ci.dist-git-pr.test.running"
|
| |
msg.body = {
|
| |
"version": "0.2.1",
|
| |
- "test": {"result": "passed",},
|
| |
+ "test": {"result": "passed"},
|
| |
"artifact": {
|
| |
"id": 456,
|
| |
"commit_hash": "abcdefghijklmnopqrst",
|
| |
"repository": "namespace/name",
|
| |
},
|
| |
- "run": {"url": "https://example.com/testing",},
|
| |
+ "run": {"url": "https://example.com/testing"},
|
| |
}
|
| |
config = {
|
| |
"pagure_token_seed": "example_seed",
|
| |
@@ -135,13 +136,13 @@
|
| |
msg.topic = "org.centos.stg.ci.dist-git-pr.test.error"
|
| |
msg.body = {
|
| |
"version": "0.2.1",
|
| |
- "test": {"result": "passed",},
|
| |
+ "test": {"result": "passed"},
|
| |
"artifact": {
|
| |
"id": 456,
|
| |
"commit_hash": "abcdefghijklmnopqrst",
|
| |
"repository": "https://host.c/namespace/name",
|
| |
},
|
| |
- "run": {"url": "https://example.com/testing",},
|
| |
+ "run": {"url": "https://example.com/testing"},
|
| |
}
|
| |
config = {
|
| |
"pagure_token_seed": "example_seed",
|
| |
@@ -151,7 +152,7 @@
|
| |
|
| |
assert (
|
| |
toddlers.plugins.flag_ci_pr.FlagCIPR.process(config=config, message=msg)
|
| |
- == None
|
| |
+ is None
|
| |
)
|
| |
assert (
|
| |
caplog.records[-3].message == "Request to https://pagure.io returned: 200"
|
| |