removing useless tests for scm_request_processor
This commit is contained in:
parent
2d291a4d6c
commit
2de83ef8cf
1 changed files with 0 additions and 152 deletions
|
@ -920,158 +920,6 @@ class TestProcessNewRepo:
|
|||
reason="Invalid",
|
||||
)
|
||||
|
||||
def test_process_new_repo_exception_validated_by_invalid_user(self):
|
||||
"""
|
||||
Assert that processing will be interrupted if the ticket is validated by
|
||||
wrong user.
|
||||
"""
|
||||
# Preparation
|
||||
user = "zlopez"
|
||||
invalid_user = "Tzeentch"
|
||||
issue = {
|
||||
"id": 100,
|
||||
"user": {"name": user},
|
||||
"comments": [
|
||||
{
|
||||
"comment": "valid",
|
||||
"user": {"name": invalid_user},
|
||||
"notification": False,
|
||||
}
|
||||
],
|
||||
}
|
||||
|
||||
repo = "repo"
|
||||
branch = "main"
|
||||
namespace = "tests"
|
||||
bug_id = ""
|
||||
action = "new_repo"
|
||||
sls = {branch: "2050-06-01"}
|
||||
monitor = "no-monitoring"
|
||||
upstreamurl = ""
|
||||
exception = False
|
||||
json = {
|
||||
"repo": repo,
|
||||
"branch": branch,
|
||||
"namespace": namespace,
|
||||
"bug_id": bug_id,
|
||||
"action": action,
|
||||
"sls": sls,
|
||||
"monitor": monitor,
|
||||
"upstreamurl": upstreamurl,
|
||||
"exception": exception,
|
||||
}
|
||||
self.toddler.pagure_io.get_project_contributors.return_value = {
|
||||
"users": {"admin": [user], "commit": [], "ticket": []}
|
||||
}
|
||||
self.toddler.validation_comment = "valid"
|
||||
|
||||
self.toddler.process_new_repo(issue, json)
|
||||
|
||||
# asserts
|
||||
self.toddler.pagure_io.get_project_contributors.assert_called_with(
|
||||
scm_request_processor.PROJECT_NAMESPACE.split("/")[0],
|
||||
scm_request_processor.PROJECT_NAMESPACE.split("/")[1],
|
||||
)
|
||||
|
||||
def test_process_new_repo_long_repo_name(self):
|
||||
"""
|
||||
Assert that ticket will be closed if provided repository name is invalid.
|
||||
"""
|
||||
# issue = {"id": 100, "user": {"name": "zlopez"}}
|
||||
user = "zlopez"
|
||||
# invalid_user = "Tzeentch"
|
||||
issue = {
|
||||
"id": 100,
|
||||
"user": {"name": user},
|
||||
"comments": [
|
||||
{
|
||||
"comment": "valid",
|
||||
"user": {"name": user},
|
||||
"notification": False,
|
||||
}
|
||||
],
|
||||
}
|
||||
|
||||
repo = "repo"
|
||||
branch = "main"
|
||||
namespace = "tests"
|
||||
bug_id = ""
|
||||
action = "new_repo"
|
||||
sls = {branch: "2050-06-01"}
|
||||
monitor = "no-monitoring"
|
||||
upstreamurl = ""
|
||||
exception = False
|
||||
json = {
|
||||
"repo": repo,
|
||||
"branch": branch,
|
||||
"namespace": namespace,
|
||||
"bug_id": bug_id,
|
||||
"action": action,
|
||||
"sls": sls,
|
||||
"monitor": monitor,
|
||||
"upstreamurl": upstreamurl,
|
||||
"exception": exception,
|
||||
}
|
||||
self.toddler.pagure_io.get_project_contributors.return_value = {
|
||||
"users": {"admin": [user], "commit": [], "ticket": []}
|
||||
}
|
||||
self.toddler.validation_comment = "valid"
|
||||
|
||||
self.toddler.process_new_repo(issue, json)
|
||||
|
||||
# asserts
|
||||
self.toddler.pagure_io.get_project_contributors.assert_called_with(
|
||||
scm_request_processor.PROJECT_NAMESPACE.split("/")[0],
|
||||
scm_request_processor.PROJECT_NAMESPACE.split("/")[1],
|
||||
)
|
||||
|
||||
def test_create_new_repo_exception_notify_maintainers(self):
|
||||
"""
|
||||
Assert that comment will be added when the ticket needs manual
|
||||
validation.
|
||||
"""
|
||||
# Preparation
|
||||
user = "zlopez"
|
||||
issue = {"id": 100, "user": {"name": user}, "comments": []}
|
||||
|
||||
repo = "repo"
|
||||
branch = "main"
|
||||
namespace = "tests"
|
||||
bug_id = ""
|
||||
action = "new_repo"
|
||||
sls = {branch: "2050-06-01"}
|
||||
monitor = "no-monitoring"
|
||||
upstreamurl = ""
|
||||
exception = False
|
||||
json = {
|
||||
"repo": repo,
|
||||
"branch": branch,
|
||||
"namespace": namespace,
|
||||
"bug_id": bug_id,
|
||||
"action": action,
|
||||
"sls": sls,
|
||||
"monitor": monitor,
|
||||
"upstreamurl": upstreamurl,
|
||||
"exception": exception,
|
||||
}
|
||||
self.toddler.pagure_io.get_project_contributors.return_value = {
|
||||
"users": {"admin": [user, "Tzeentch"], "commit": [], "ticket": []}
|
||||
}
|
||||
self.toddler.ping_comment = "Look at this comment {maintainers}"
|
||||
self.toddler.process_new_repo(issue, json)
|
||||
|
||||
# asserts
|
||||
self.toddler.pagure_io.get_project_contributors.assert_called_with(
|
||||
scm_request_processor.PROJECT_NAMESPACE.split("/")[0],
|
||||
scm_request_processor.PROJECT_NAMESPACE.split("/")[1],
|
||||
)
|
||||
|
||||
message = "Look at this comment @Tzeentch @{}".format(user)
|
||||
|
||||
self.toddler.pagure_io.add_comment_to_issue.assert_called_with(
|
||||
100, namespace=scm_request_processor.PROJECT_NAMESPACE, comment=message
|
||||
)
|
||||
|
||||
def test_process_new_repo_missing_bug_id(self):
|
||||
"""
|
||||
Assert that ticket will be closed if Bugzilla bug id is not provided.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue