From 43dc721c0a9af59e7693340629eb8e5ff0869ee0 Mon Sep 17 00:00:00 2001 From: james02135 Date: Mar 10 2023 14:51:09 +0000 Subject: Conform to Fedora Messaging Signed-off-by: james02135 --- diff --git a/pagure_messages/base.py b/pagure_messages/base.py index bd522fe..5db5fc0 100644 --- a/pagure_messages/base.py +++ b/pagure_messages/base.py @@ -13,6 +13,7 @@ # You should have received a copy of the GNU General Public License along # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +import warnings from fedora_messaging import message from fedora_messaging.schema_utils import user_avatar_url @@ -422,12 +423,21 @@ class PagureMessage(message.Message): @property def agent(self): - return self.body.get("agent") + warnings.warn( + "agent property is deprecated, please use agent_name instead", + DeprecationWarning, + stacklevel=2, + ) + return self.body.get("agent_name") + + @property + def agent_name(self): + return self.body.get("agent_name") @property def agent_avatar(self): - return user_avatar_url(self.agent) + return user_avatar_url(self.agent_name) @property def usernames(self): - return [self.agent] + return [self.agent_name] diff --git a/pagure_messages/git_schema.py b/pagure_messages/git_schema.py index 2759d18..94669bf 100644 --- a/pagure_messages/git_schema.py +++ b/pagure_messages/git_schema.py @@ -32,26 +32,27 @@ class GitBranchCreationV1(PagureMessage): "type": "object", "properties": { "agent": {"type": "string"}, + "agent_name": {"type": "string"}, "repo": PROJECT, "tag": {"type": "string"}, "rev": {"type": "string"}, "authors": {"type": "array", "items": GIT_RECEIVE_USER}, }, - "required": ["agent", "repo", "branch", "rev", "authors"], + "required": ["agent_name", "repo", "branch", "rev", "authors"], } def __str__(self): """Return a complete human-readable representation of the message.""" - return "Git branch: {branch} created\nBy: {agent}".format( + return "Git branch: {branch} created\nBy: {agent_name}".format( branch=self.body["branch"], - agent=self.body["agent"], + agent_name=self.body["agent_name"], ) @property def summary(self): """Return a summary of the message.""" - return "{agent} created the branch {branch} on {name}".format( - agent=self.body["agent"], + return "{agent_name} created the branch {branch} on {name}".format( + agent_name=self.body["agent_name"], name=self.body["repo"]["fullname"], branch=self.body["branch"], ) @@ -84,26 +85,27 @@ class GitBranchDeletionV1(PagureMessage): "type": "object", "properties": { "agent": {"type": "string"}, + "agent_name": {"type": "string"}, "repo": PROJECT, "tag": {"type": "string"}, "rev": {"type": "string"}, "authors": {"type": "array", "items": GIT_RECEIVE_USER}, }, - "required": ["agent", "repo", "branch", "rev", "authors"], + "required": ["agent_name", "repo", "branch", "rev", "authors"], } def __str__(self): """Return a complete human-readable representation of the message.""" - return "Git branch: {branch} deleted\nBy: {agent}".format( + return "Git branch: {branch} deleted\nBy: {agent_name}".format( branch=self.body["branch"], - agent=self.body["agent"], + agent_name=self.body["agent_name"], ) @property def summary(self): """Return a summary of the message.""" - return "{agent} deleted the branch {branch} on {name}".format( - agent=self.body["agent"], + return "{agent_name} deleted the branch {branch} on {name}".format( + agent_name=self.body["agent_name"], name=self.body["repo"]["fullname"], branch=self.body["branch"], ) @@ -132,6 +134,7 @@ class GitReceiveV1(PagureMessage): "type": "object", "properties": { "agent": {"type": "string"}, + "agent_name": {"type": "string"}, "forced": {"type": "boolean"}, "repo": PROJECT, "old_commit": {"type": "string"}, @@ -142,7 +145,7 @@ class GitReceiveV1(PagureMessage): "end_commit": {"type": "string"}, }, "required": [ - "agent", + "agent_name", "forced", "repo", "old_commit", @@ -156,16 +159,16 @@ class GitReceiveV1(PagureMessage): def __str__(self): """Return a complete human-readable representation of the message.""" - return "New commit: {count} commits\nBy: {agent}".format( + return "New commit: {count} commits\nBy: {agent_name}".format( count=self.body["total_commits"], - agent=self.body["agent"], + agent_name=self.body["agent_name"], ) @property def summary(self): """Return a summary of the message.""" - return "{agent} pushed {count} commits on {fullname} (branch: {branch})".format( - agent=self.body["agent"], + return "{agent_name} pushed {count} commits on {fullname} (branch: {branch})".format( + agent_name=self.body["agent_name"], fullname=self.body["repo"]["fullname"], count=self.body["total_commits"], branch=self.body["branch"], @@ -199,26 +202,27 @@ class GitTagCreationV1(PagureMessage): "type": "object", "properties": { "agent": {"type": "string"}, + "agent_name": {"type": "string"}, "repo": PROJECT, "tag": {"type": "string"}, "rev": {"type": "string"}, "authors": {"type": "array", "items": GIT_RECEIVE_USER}, }, - "required": ["agent", "repo", "tag", "rev", "authors"], + "required": ["agent_name", "repo", "tag", "rev", "authors"], } def __str__(self): """Return a complete human-readable representation of the message.""" - return "Git tag: {tag} created\nBy: {agent}".format( + return "Git tag: {tag} created\nBy: {agent_name}".format( tag=self.body["tag"], - agent=self.body["agent"], + agent_name=self.body["agent_name"], ) @property def summary(self): """Return a summary of the message.""" - return "{agent} tagged the commit {rev} on {name} as {tag}".format( - agent=self.body["agent"], + return "{agent_name} tagged the commit {rev} on {name} as {tag}".format( + agent_name=self.body["agent_name"], name=self.body["repo"]["fullname"], tag=self.body["tag"], rev=self.body["rev"], @@ -249,26 +253,27 @@ class GitTagDeletionV1(PagureMessage): "type": "object", "properties": { "agent": {"type": "string"}, + "agent_name": {"type": "string"}, "repo": PROJECT, "tag": {"type": "string"}, "rev": {"type": "string"}, "authors": {"type": "array", "items": GIT_RECEIVE_USER}, }, - "required": ["agent", "repo", "tag", "rev", "authors"], + "required": ["agent_name", "repo", "tag", "rev", "authors"], } def __str__(self): """Return a complete human-readable representation of the message.""" - return "Git tag: {tag} deleted\nBy: {agent}".format( + return "Git tag: {tag} deleted\nBy: {agent_name}".format( tag=self.body["tag"], - agent=self.body["agent"], + agent_name=self.body["agent_name"], ) @property def summary(self): """Return a summary of the message.""" - return "{agent} deleted the tag {tag} of commit {rev} on {name}".format( - agent=self.body["agent"], + return "{agent_name} deleted the tag {tag} of commit {rev} on {name}".format( + agent_name=self.body["agent_name"], name=self.body["repo"]["fullname"], tag=self.body["tag"], rev=self.body["rev"], diff --git a/pagure_messages/issue_schema.py b/pagure_messages/issue_schema.py index 088532d..cdf1925 100644 --- a/pagure_messages/issue_schema.py +++ b/pagure_messages/issue_schema.py @@ -32,26 +32,27 @@ class IssueAssignedAddedV1(PagureMessage): "type": "object", "properties": { "agent": {"type": "string"}, + "agent_name": {"type": "string"}, "project": PROJECT, "issue": ISSUE, }, - "required": ["agent", "project", "issue"], + "required": ["agent_name", "project", "issue"], } def __str__(self): """Return a complete human-readable representation of the message.""" - return "Issue: {fullname}#{id} assigned to {assignee}\nBy: {agent}".format( + return "Issue: {fullname}#{id} assigned to {assignee}\nBy: {agent_name}".format( fullname=self.body["project"]["fullname"], id=self.body["issue"]["id"], - agent=self.body["agent"], + agent_name=self.body["agent_name"], assignee=self.body["issue"]["assignee"]["name"], ) @property def summary(self): """Return a summary of the message.""" - return "{agent} assigned issue {name}#{id} to {assignee}".format( - agent=self.body["agent"], + return "{agent_name} assigned issue {name}#{id} to {assignee}".format( + agent_name=self.body["agent_name"], name=self.body["project"]["fullname"], id=self.body["issue"]["id"], assignee=self.body["issue"]["assignee"]["name"], @@ -77,25 +78,26 @@ class IssueAssignedResetV1(PagureMessage): "type": "object", "properties": { "agent": {"type": "string"}, + "agent_name": {"type": "string"}, "project": PROJECT, "issue": ISSUE, }, - "required": ["agent", "project", "issue"], + "required": ["agent_name", "project", "issue"], } def __str__(self): """Return a complete human-readable representation of the message.""" - return "Issue un-assigned: {fullname}#{id}\nBy: {agent}".format( + return "Issue un-assigned: {fullname}#{id}\nBy: {agent_name}".format( fullname=self.body["project"]["fullname"], id=self.body["issue"]["id"], - agent=self.body["agent"], + agent_name=self.body["agent_name"], ) @property def summary(self): """Return a summary of the message.""" - return "{agent} reset the assignee on issue {name}#{id}".format( - agent=self.body["agent"], + return "{agent_name} reset the assignee on issue {name}#{id}".format( + agent_name=self.body["agent_name"], name=self.body["project"]["fullname"], id=self.body["issue"]["id"], ) @@ -120,25 +122,26 @@ class IssueCommentAddedV1(PagureMessage): "type": "object", "properties": { "agent": {"type": "string"}, + "agent_name": {"type": "string"}, "project": PROJECT, "issue": ISSUE, }, - "required": ["agent", "project"], + "required": ["agent_name", "project"], } def __str__(self): """Return a complete human-readable representation of the message.""" - return "Issue: {fullname}#{id} has a new comment\nBy: {agent}".format( + return "Issue: {fullname}#{id} has a new comment\nBy: {agent_name}".format( fullname=self.body["project"]["fullname"], id=self.body["issue"]["id"], - agent=self.body["agent"], + agent_name=self.body["agent_name"], ) @property def summary(self): """Return a summary of the message.""" - return "{agent} commented on the issue {name}#{id}".format( - agent=self.body["agent"], + return "{agent_name} commented on the issue {name}#{id}".format( + agent_name=self.body["agent_name"], name=self.body["project"]["fullname"], id=self.body["issue"]["id"], ) @@ -168,27 +171,30 @@ class IssueDependencyAddedV1(PagureMessage): "type": "object", "properties": { "agent": {"type": "string"}, + "agent_name": {"type": "string"}, "project": PROJECT, "issue": ISSUE, "added_dependency": {"type": "number"}, }, - "required": ["agent", "project", "added_dependency"], + "required": ["agent_name", "project", "added_dependency"], } def __str__(self): """Return a complete human-readable representation of the message.""" - return "Issue: {fullname}#{id} depends on #{depissueid}\nBy: {agent}".format( - fullname=self.body["project"]["fullname"], - id=self.body["issue"]["id"], - agent=self.body["agent"], - depissueid=self.body["added_dependency"], + return ( + "Issue: {fullname}#{id} depends on #{depissueid}\nBy: {agent_name}".format( + fullname=self.body["project"]["fullname"], + id=self.body["issue"]["id"], + agent_name=self.body["agent_name"], + depissueid=self.body["added_dependency"], + ) ) @property def summary(self): """Return a summary of the message.""" - return "{agent} set the issue {name}#{id} as depending on #{depissueid}".format( - agent=self.body["agent"], + return "{agent_name} set the issue {name}#{id} as depending on #{depissueid}".format( + agent_name=self.body["agent_name"], name=self.body["project"]["fullname"], id=self.body["issue"]["id"], depissueid=self.body["added_dependency"], @@ -214,30 +220,41 @@ class IssueDependencyRemovedV1(PagureMessage): "type": "object", "properties": { "agent": {"type": "string"}, + "agent_name": {"type": "string"}, "project": PROJECT, "issue": ISSUE, "removed_dependency": {"type": "array", "items": {"type": "number"}}, }, - "required": ["agent", "project", "removed_dependency"], + "required": ["agent_name", "project", "removed_dependency"], } def __str__(self): """Return a complete human-readable representation of the message.""" - return "Issue: {fullname}#{id} no longer depending on #{depissueid}\nBy: {agent}".format( - fullname=self.body["project"]["fullname"], - id=self.body["issue"]["id"], - agent=self.body["agent"], - depissueid=", #".join([str(i) for i in self.body["removed_dependency"]]), + return ( + "Issue: {fullname}#{id} no longer depending" + " on #{depissueid}\nBy: {agent_name}".format( + fullname=self.body["project"]["fullname"], + id=self.body["issue"]["id"], + agent_name=self.body["agent_name"], + depissueid=", #".join( + [str(i) for i in self.body["removed_dependency"]] + ), + ) ) @property def summary(self): """Return a summary of the message.""" - return "{agent} removed the dependency on #{depissueid} on the issue {name}#{id}".format( - agent=self.body["agent"], - name=self.body["project"]["fullname"], - id=self.body["issue"]["id"], - depissueid=", #".join([str(i) for i in self.body["removed_dependency"]]), + return ( + "{agent_name} removed the dependency" + " on #{depissueid} on the issue {name}#{id}".format( + agent_name=self.body["agent_name"], + name=self.body["project"]["fullname"], + id=self.body["issue"]["id"], + depissueid=", #".join( + [str(i) for i in self.body["removed_dependency"]] + ), + ) ) @property @@ -260,25 +277,26 @@ class IssueDropV1(PagureMessage): "type": "object", "properties": { "agent": {"type": "string"}, + "agent_name": {"type": "string"}, "project": PROJECT, "issue": ISSUE, }, - "required": ["agent", "project", "issue"], + "required": ["agent_name", "project", "issue"], } def __str__(self): """Return a complete human-readable representation of the message.""" - return "Issue deleted: {fullname}#{id}\nBy: {agent}".format( + return "Issue deleted: {fullname}#{id}\nBy: {agent_name}".format( fullname=self.body["project"]["fullname"], id=self.body["issue"]["id"], - agent=self.body["agent"], + agent_name=self.body["agent_name"], ) @property def summary(self): """Return a summary of the message.""" - return "{agent} deleted issue {name}#{id}: {title}".format( - agent=self.body["agent"], + return "{agent_name} deleted issue {name}#{id}: {title}".format( + agent_name=self.body["agent_name"], name=self.body["project"]["fullname"], id=self.body["issue"]["id"], title=self.body["issue"]["title"], @@ -306,30 +324,33 @@ class IssueEditV1(PagureMessage): "type": "object", "properties": { "agent": {"type": "string"}, + "agent_name": {"type": "string"}, "project": PROJECT, "issue": ISSUE, "fields": {"type": "array", "items": {"type": ["string", "null"]}}, }, - "required": ["agent", "project", "issue", "fields"], + "required": ["agent_name", "project", "issue", "fields"], } def __str__(self): """Return a complete human-readable representation of the message.""" - return "Edited Issue: {fullname}#{id}\nBy: {agent}".format( + return "Edited Issue: {fullname}#{id}\nBy: {agent_name}".format( fullname=self.body["project"]["fullname"], id=self.body["issue"]["id"], - agent=self.body["agent"], + agent_name=self.body["agent_name"], ) @property def summary(self): """Return a summary of the message.""" - return "{agent} edited fields {fields} of issue {name}#{id}: {title}".format( - agent=self.body["agent"], - name=self.body["project"]["fullname"], - id=self.body["issue"]["id"], - title=self.body["issue"]["title"], - fields=", ".join(self.body["fields"]), + return ( + "{agent_name} edited fields {fields} of issue {name}#{id}: {title}".format( + agent_name=self.body["agent_name"], + name=self.body["project"]["fullname"], + id=self.body["issue"]["id"], + title=self.body["issue"]["title"], + fields=", ".join(self.body["fields"]), + ) ) @property @@ -352,25 +373,26 @@ class IssueNewV1(PagureMessage): "type": "object", "properties": { "agent": {"type": "string"}, + "agent_name": {"type": "string"}, "project": PROJECT, "issue": ISSUE, }, - "required": ["agent", "project", "issue"], + "required": ["agent_name", "project", "issue"], } def __str__(self): """Return a complete human-readable representation of the message.""" - return "New Issue: {fullname}#{id}\nBy: {agent}".format( + return "New Issue: {fullname}#{id}\nBy: {agent_name}".format( fullname=self.body["project"]["fullname"], id=self.body["issue"]["id"], - agent=self.body["agent"], + agent_name=self.body["agent_name"], ) @property def summary(self): """Return a summary of the message.""" - return "{agent} created issue {name}#{id}: {title}".format( - agent=self.body["agent"], + return "{agent_name} created issue {name}#{id}: {title}".format( + agent_name=self.body["agent_name"], name=self.body["project"]["fullname"], id=self.body["issue"]["id"], title=self.body["issue"]["title"], @@ -396,27 +418,28 @@ class IssueTagAddedV1(PagureMessage): "type": "object", "properties": { "agent": {"type": "string"}, + "agent_name": {"type": "string"}, "project": PROJECT, "issue": ISSUE, "tags": {"type": "array", "items": {"type": "string"}}, }, - "required": ["agent", "project"], + "required": ["agent_name", "project"], } def __str__(self): """Return a complete human-readable representation of the message.""" - return "Issue: {fullname}#{id} tagged with {tags}\nBy: {agent}".format( + return "Issue: {fullname}#{id} tagged with {tags}\nBy: {agent_name}".format( fullname=self.body["project"]["fullname"], id=self.body["issue"]["id"], - agent=self.body["agent"], + agent_name=self.body["agent_name"], tags=", ".join(self.body["tags"]), ) @property def summary(self): """Return a summary of the message.""" - return "{agent} tagged the issue {name}#{id} with: {tags}".format( - agent=self.body["agent"], + return "{agent_name} tagged the issue {name}#{id} with: {tags}".format( + agent_name=self.body["agent_name"], name=self.body["project"]["fullname"], id=self.body["issue"]["id"], tags=", ".join(self.body["tags"]), @@ -442,27 +465,28 @@ class IssueTagRemovedV1(PagureMessage): "type": "object", "properties": { "agent": {"type": "string"}, + "agent_name": {"type": "string"}, "project": PROJECT, "issue": ISSUE, "tags": {"type": "array", "items": {"type": "string"}}, }, - "required": ["agent", "project"], + "required": ["agent_name", "project"], } def __str__(self): """Return a complete human-readable representation of the message.""" - return "Issue: {fullname}#{id} un-tagged with {tags}\nBy: {agent}".format( + return "Issue: {fullname}#{id} un-tagged with {tags}\nBy: {agent_name}".format( fullname=self.body["project"]["fullname"], id=self.body["issue"]["id"], - agent=self.body["agent"], + agent_name=self.body["agent_name"], tags=", ".join(self.body["tags"]), ) @property def summary(self): """Return a summary of the message.""" - return "{agent} removed tags {tags} from issue {name}#{id}".format( - agent=self.body["agent"], + return "{agent_name} removed tags {tags} from issue {name}#{id}".format( + agent_name=self.body["agent_name"], name=self.body["project"]["fullname"], id=self.body["issue"]["id"], tags=", ".join(self.body["tags"]), diff --git a/pagure_messages/misc_schema.py b/pagure_messages/misc_schema.py index ec01186..f93c510 100644 --- a/pagure_messages/misc_schema.py +++ b/pagure_messages/misc_schema.py @@ -32,16 +32,17 @@ class CommitFlagAddedV1(PagureMessage): "type": "object", "properties": { "agent": {"type": "string"}, + "agent_name": {"type": "string"}, "repo": PROJECT, "flag": COMMIT_FLAG, }, - "required": ["agent", "repo", "flag"], + "required": ["agent_name", "repo", "flag"], } def __str__(self): """Return a complete human-readable representation of the message.""" - return "New commit flag: {username} {status}\nBy: {agent}".format( - agent=self.body["agent"], + return "New commit flag: {username} {status}\nBy: {agent_name}".format( + agent_name=self.body["agent_name"], username=self.body["flag"]["username"], status=self.body["flag"]["status"], ) @@ -84,16 +85,17 @@ class CommitFlagUpdatedV1(PagureMessage): "type": "object", "properties": { "agent": {"type": "string"}, + "agent_name": {"type": "string"}, "repo": PROJECT, "flag": COMMIT_FLAG, }, - "required": ["agent", "repo", "flag"], + "required": ["agent_name", "repo", "flag"], } def __str__(self): """Return a complete human-readable representation of the message.""" - return "New commit flag: {username} {status}\nBy: {agent}".format( - agent=self.body["agent"], + return "New commit flag: {username} {status}\nBy: {agent_name}".format( + agent_name=self.body["agent_name"], username=self.body["flag"]["username"], status=self.body["flag"]["status"], ) @@ -136,26 +138,29 @@ class GroupEditV1(PagureMessage): "type": "object", "properties": { "agent": {"type": "string"}, + "agent_name": {"type": "string"}, "group": GROUP, "fields": {"type": "array", "items": {"type": "string"}}, }, - "required": ["agent", "group", "fields"], + "required": ["agent_name", "group", "fields"], } def __str__(self): """Return a complete human-readable representation of the message.""" - return "Group edit: {group_name}\nBy: {agent}".format( - agent=self.body["agent"], + return "Group edit: {group_name}\nBy: {agent_name}".format( + agent_name=self.body["agent_name"], group_name=self.body["group"]["name"], ) @property def summary(self): """Return a summary of the message.""" - return "{agent} edited the fields {fields} of the group {group_name}".format( - agent=self.body["agent"], - group_name=self.body["group"]["name"], - fields=", ".join(self.body["fields"]), + return ( + "{agent_name} edited the fields {fields} of the group {group_name}".format( + agent_name=self.body["agent_name"], + group_name=self.body["group"]["name"], + fields=", ".join(self.body["fields"]), + ) ) @property diff --git a/pagure_messages/project_schema.py b/pagure_messages/project_schema.py index 4e22275..e5d393d 100644 --- a/pagure_messages/project_schema.py +++ b/pagure_messages/project_schema.py @@ -30,22 +30,26 @@ class ProjectNewV1(PagureMessage): "$schema": "http://json-schema.org/draft-04/schema#", "description": "Schema for messages sent when a new project is created", "type": "object", - "properties": {"agent": {"type": "string"}, "project": PROJECT}, - "required": ["agent", "project"], + "properties": { + "agent": {"type": "string"}, + "agent_name": {"type": "string"}, + "project": PROJECT, + }, + "required": ["agent_name", "project"], } def __str__(self): """Return a complete human-readable representation of the message.""" - return "New Project: {fullname}\nBy: {agent}".format( + return "New Project: {fullname}\nBy: {agent_name}".format( fullname=self.body["project"]["fullname"], - agent=self.body["agent"], + agent_name=self.body["agent_name"], ) @property def summary(self): """Return a summary of the message.""" - return '{agent} created project "{name}"'.format( - agent=self.body["agent"], + return '{agent_name} created project "{name}"'.format( + agent_name=self.body["agent_name"], name=self.body["project"]["fullname"], ) @@ -69,24 +73,25 @@ class ProjectEditV1(PagureMessage): "type": "object", "properties": { "agent": {"type": "string"}, + "agent_name": {"type": "string"}, "project": PROJECT, "fields": {"type": "array", "items": {"type": ["string", "null"]}}, }, - "required": ["agent", "project", "fields"], + "required": ["agent_name", "project", "fields"], } def __str__(self): """Return a complete human-readable representation of the message.""" - return "Project Edited: {fullname}\nBy: {agent}".format( + return "Project Edited: {fullname}\nBy: {agent_name}".format( fullname=self.body["project"]["fullname"], - agent=self.body["agent"], + agent_name=self.body["agent_name"], ) @property def summary(self): """Return a summary of the message.""" - return '{agent} edited the fields {fields} of project "{name}"'.format( - agent=self.body["agent"], + return '{agent_name} edited the fields {fields} of project "{name}"'.format( + agent_name=self.body["agent_name"], fields=", ".join(self.body["fields"]), name=self.body["project"]["fullname"], ) @@ -109,22 +114,26 @@ class ProjectForkedV1(PagureMessage): "$schema": "http://json-schema.org/draft-04/schema#", "description": "Schema for messages sent when a new project is created", "type": "object", - "properties": {"agent": {"type": "string"}, "project": PROJECT}, - "required": ["agent", "project"], + "properties": { + "agent": {"type": "string"}, + "agent_name": {"type": "string"}, + "project": PROJECT, + }, + "required": ["agent_name", "project"], } def __str__(self): """Return a complete human-readable representation of the message.""" - return "Project: {fullname}\nForked by: {agent}".format( + return "Project: {fullname}\nForked by: {agent_name}".format( fullname=self.body["project"]["parent"]["fullname"], - agent=self.body["agent"], + agent_name=self.body["agent_name"], ) @property def summary(self): """Return a summary of the message.""" - return '{agent} forked project "{parent}" to {name}'.format( - agent=self.body["agent"], + return '{agent_name} forked project "{parent}" to {name}'.format( + agent_name=self.body["agent_name"], parent=self.body["project"]["parent"]["fullname"], name=self.body["project"]["fullname"], ) @@ -147,22 +156,26 @@ class ProjectDeletedV1(PagureMessage): "$schema": "http://json-schema.org/draft-04/schema#", "description": "Schema for messages sent when a new project is created", "type": "object", - "properties": {"agent": {"type": "string"}, "project": PROJECT}, - "required": ["agent", "project"], + "properties": { + "agent": {"type": "string"}, + "agent_name": {"type": "string"}, + "project": PROJECT, + }, + "required": ["agent_name", "project"], } def __str__(self): """Return a complete human-readable representation of the message.""" - return "Project: {fullname}\nDeleted by: {agent}".format( + return "Project: {fullname}\nDeleted by: {agent_name}".format( fullname=self.body["project"]["fullname"], - agent=self.body["agent"], + agent_name=self.body["agent_name"], ) @property def summary(self): """Return a summary of the message.""" - return '{agent} deleted project "{name}"'.format( - agent=self.body["agent"], + return '{agent_name} deleted project "{name}"'.format( + agent_name=self.body["agent_name"], name=self.body["project"]["fullname"], ) @@ -184,26 +197,32 @@ class ProjectGroupAddedV1(PagureMessage): "$schema": "http://json-schema.org/draft-04/schema#", "description": "Schema for messages sent when a new project is created", "type": "object", - "properties": {"agent": {"type": "string"}, "project": PROJECT}, - "required": ["agent", "project"], + "properties": { + "agent": {"type": "string"}, + "agent_name": {"type": "string"}, + "project": PROJECT, + }, + "required": ["agent_name", "project"], } def __str__(self): """Return a complete human-readable representation of the message.""" - return "Group: {group} added to {fullname} as {access}\nBy: {agent}".format( - fullname=self.body["project"]["fullname"], - group=self.body["new_group"], - access=self.body["access"], - agent=self.body["agent"], + return ( + "Group: {group} added to {fullname} as {access}\nBy: {agent_name}".format( + fullname=self.body["project"]["fullname"], + group=self.body["new_group"], + access=self.body["access"], + agent_name=self.body["agent_name"], + ) ) @property def summary(self): """Return a summary of the message.""" return ( - '{agent} added the group {group} to the project "{name}" at ' + '{agent_name} added the group {group} to the project "{name}" at ' "the {access} level".format( - agent=self.body["agent"], + agent_name=self.body["agent_name"], group=self.body["new_group"], access=self.body["access"], name=self.body["project"]["fullname"], @@ -230,28 +249,31 @@ class ProjectGroupRemovedV1(PagureMessage): "type": "object", "properties": { "agent": {"type": "string"}, + "agent_name": {"type": "string"}, "project": PROJECT, "removed_groups": {"type": "array", "items": {"type": "string"}}, }, - "required": ["agent", "project"], + "required": ["agent_name", "project"], } def __str__(self): """Return a complete human-readable representation of the message.""" - return "Group: {group} removed from {fullname}({access})\nBy: {agent}".format( - fullname=self.body["project"]["fullname"], - group=self.body["new_group"], - access=self.body["access"], - agent=self.body["agent"], + return ( + "Group: {group} removed from {fullname}({access})\nBy: {agent_name}".format( + fullname=self.body["project"]["fullname"], + group=self.body["new_group"], + access=self.body["access"], + agent_name=self.body["agent_name"], + ) ) @property def summary(self): """Return a summary of the message.""" return ( - "{agent} removed the group {group} (with {access} level) from the " + "{agent_name} removed the group {group} (with {access} level) from the " 'project "{name}"'.format( - agent=self.body["agent"], + agent_name=self.body["agent_name"], group=self.body["new_group"], access=self.body["access"], name=self.body["project"]["fullname"], @@ -276,26 +298,30 @@ class ProjectGroupAccessUpdatedV1(PagureMessage): "$schema": "http://json-schema.org/draft-04/schema#", "description": "Schema for messages sent when a new project is created", "type": "object", - "properties": {"agent": {"type": "string"}, "project": PROJECT}, - "required": ["agent", "project"], + "properties": { + "agent": {"type": "string"}, + "agent_name": {"type": "string"}, + "project": PROJECT, + }, + "required": ["agent_name", "project"], } def __str__(self): """Return a complete human-readable representation of the message.""" - return "Group: {group} access updated to {access} on {fullname}\nBy: {agent}".format( + return "Group: {group} access updated to {access} on {fullname}\nBy: {agent_name}".format( fullname=self.body["project"]["fullname"], group=self.body["new_group"], access=self.body["new_access"], - agent=self.body["agent"], + agent_name=self.body["agent_name"], ) @property def summary(self): """Return a summary of the message.""" return ( - "{agent} updated the access of group {group} to {access} on " + "{agent_name} updated the access of group {group} to {access} on " 'the project "{name}"'.format( - agent=self.body["agent"], + agent_name=self.body["agent_name"], group=self.body["new_group"], access=self.body["new_access"], name=self.body["project"]["fullname"], @@ -320,23 +346,27 @@ class ProjectTagEditedV1(PagureMessage): "$schema": "http://json-schema.org/draft-04/schema#", "description": "Schema for messages sent when a new project is created", "type": "object", - "properties": {"agent": {"type": "string"}, "project": PROJECT}, - "required": ["agent", "project"], + "properties": { + "agent": {"type": "string"}, + "agent_name": {"type": "string"}, + "project": PROJECT, + }, + "required": ["agent_name", "project"], } def __str__(self): """Return a complete human-readable representation of the message.""" - return "Tag: {tag_name} edited on {fullname}\nBy: {agent}".format( + return "Tag: {tag_name} edited on {fullname}\nBy: {agent_name}".format( fullname=self.body["project"]["fullname"], tag_name=self.body["new_tag"], - agent=self.body["agent"], + agent_name=self.body["agent_name"], ) @property def summary(self): """Return a summary of the message.""" - return '{agent} edited the tag {tag_name} on the project "{name}"'.format( - agent=self.body["agent"], + return '{agent_name} edited the tag {tag_name} on the project "{name}"'.format( + agent_name=self.body["agent_name"], tag_name=self.body["new_tag"], name=self.body["project"]["fullname"], ) @@ -359,23 +389,27 @@ class ProjectTagRemovedV1(PagureMessage): "$schema": "http://json-schema.org/draft-04/schema#", "description": "Schema for messages sent when a new project is created", "type": "object", - "properties": {"agent": {"type": "string"}, "project": PROJECT}, - "required": ["agent", "project"], + "properties": { + "agent": {"type": "string"}, + "agent_name": {"type": "string"}, + "project": PROJECT, + }, + "required": ["agent_name", "project"], } def __str__(self): """Return a complete human-readable representation of the message.""" - return "Tag(s): {tags} removed from {fullname}\nBy: {agent}".format( + return "Tag(s): {tags} removed from {fullname}\nBy: {agent_name}".format( fullname=self.body["project"]["fullname"], tags=", ".join(self.body["tags"]), - agent=self.body["agent"], + agent_name=self.body["agent_name"], ) @property def summary(self): """Return a summary of the message.""" - return '{agent} removed the tag(s) {tags} of project "{name}"'.format( - agent=self.body["agent"], + return '{agent_name} removed the tag(s) {tags} of project "{name}"'.format( + agent_name=self.body["agent_name"], tags=", ".join(self.body["tags"]), name=self.body["project"]["fullname"], ) @@ -398,26 +432,30 @@ class ProjectUserAccessUpdatedV1(PagureMessage): "$schema": "http://json-schema.org/draft-04/schema#", "description": "Schema for messages sent when a new project is created", "type": "object", - "properties": {"agent": {"type": "string"}, "project": PROJECT}, - "required": ["agent", "project"], + "properties": { + "agent": {"type": "string"}, + "agent_name": {"type": "string"}, + "project": PROJECT, + }, + "required": ["agent_name", "project"], } def __str__(self): """Return a complete human-readable representation of the message.""" - return "User: {user} access edited to {new_access} on {fullname}\nBy: {agent}".format( + return "User: {user} access edited to {new_access} on {fullname}\nBy: {agent_name}".format( fullname=self.body["project"]["fullname"], user=self.body["new_user"], new_access=self.body["new_access"], - agent=self.body["agent"], + agent_name=self.body["agent_name"], ) @property def summary(self): """Return a summary of the message.""" return ( - "{agent} updated the access of {user} to {new_access} on the " + "{agent_name} updated the access of {user} to {new_access} on the " 'project "{name}"'.format( - agent=self.body["agent"], + agent_name=self.body["agent_name"], user=self.body["new_user"], new_access=self.body["new_access"], name=self.body["project"]["fullname"], @@ -442,23 +480,27 @@ class ProjectUserAddedV1(PagureMessage): "$schema": "http://json-schema.org/draft-04/schema#", "description": "Schema for messages sent when a new project is created", "type": "object", - "properties": {"agent": {"type": "string"}, "project": PROJECT}, - "required": ["agent", "project"], + "properties": { + "agent": {"type": "string"}, + "agent_name": {"type": "string"}, + "project": PROJECT, + }, + "required": ["agent_name", "project"], } def __str__(self): """Return a complete human-readable representation of the message.""" - return "User: {user} added to {fullname}\nBy: {agent}".format( + return "User: {user} added to {fullname}\nBy: {agent_name}".format( fullname=self.body["project"]["fullname"], user=self.body["new_user"], - agent=self.body["agent"], + agent_name=self.body["agent_name"], ) @property def summary(self): """Return a summary of the message.""" - return '{agent} added the {user} to the project "{name}"'.format( - agent=self.body["agent"], + return '{agent_name} added the {user} to the project "{name}"'.format( + agent_name=self.body["agent_name"], user=self.body["new_user"], name=self.body["project"]["fullname"], ) @@ -481,23 +523,27 @@ class ProjectUserRemovedV1(PagureMessage): "$schema": "http://json-schema.org/draft-04/schema#", "description": "Schema for messages sent when a new project is created", "type": "object", - "properties": {"agent": {"type": "string"}, "project": PROJECT}, - "required": ["agent", "project"], + "properties": { + "agent": {"type": "string"}, + "agent_name": {"type": "string"}, + "project": PROJECT, + }, + "required": ["agent_name", "project"], } def __str__(self): """Return a complete human-readable representation of the message.""" - return "User: {user} removed from {fullname}\nBy: {agent}".format( + return "User: {user} removed from {fullname}\nBy: {agent_name}".format( fullname=self.body["project"]["fullname"], user=self.body["removed_user"], - agent=self.body["agent"], + agent_name=self.body["agent_name"], ) @property def summary(self): """Return a summary of the message.""" - return '{agent} removed the {user} from the project "{name}"'.format( - agent=self.body["agent"], + return '{agent_name} removed the {user} from the project "{name}"'.format( + agent_name=self.body["agent_name"], user=self.body["removed_user"], name=self.body["project"]["fullname"], ) diff --git a/pagure_messages/pull_requests_schema.py b/pagure_messages/pull_requests_schema.py index 4c8b4c2..d0017d5 100644 --- a/pagure_messages/pull_requests_schema.py +++ b/pagure_messages/pull_requests_schema.py @@ -32,16 +32,17 @@ class PullRequestAssignedAddedV1(PagureMessage): "type": "object", "properties": { "agent": {"type": "string"}, + "agent_name": {"type": "string"}, "pullrequest": PULL_REQUEST, "project": PROJECT, }, - "required": ["agent", "pullrequest", "project"], + "required": ["agent_name", "pullrequest", "project"], } def __str__(self): """Return a complete human-readable representation of the message.""" - return "Pull-request {name}#{id} was assigned\nBy: {agent}".format( - agent=self.body["agent"], + return "Pull-request {name}#{id} was assigned\nBy: {agent_name}".format( + agent_name=self.body["agent_name"], name=self.body["pullrequest"]["project"]["fullname"], id=self.body["pullrequest"]["id"], ) @@ -52,7 +53,7 @@ class PullRequestAssignedAddedV1(PagureMessage): return "{username} assigned the pull-request {name}#{id} to {assignee}".format( name=self.body["pullrequest"]["project"]["fullname"], id=self.body["pullrequest"]["id"], - username=self.body["agent"], + username=self.body["agent_name"], assignee=self.body["pullrequest"]["assignee"]["name"], ) @@ -76,16 +77,17 @@ class PullRequestAssignedResetV1(PagureMessage): "type": "object", "properties": { "agent": {"type": "string"}, + "agent_name": {"type": "string"}, "pullrequest": PULL_REQUEST, "project": PROJECT, }, - "required": ["agent", "pullrequest", "project"], + "required": ["agent_name", "pullrequest", "project"], } def __str__(self): """Return a complete human-readable representation of the message.""" - return "Pull-request {name}#{id} was un-assigned\nBy: {agent}".format( - agent=self.body["agent"], + return "Pull-request {name}#{id} was un-assigned\nBy: {agent_name}".format( + agent_name=self.body["agent_name"], name=self.body["pullrequest"]["project"]["fullname"], id=self.body["pullrequest"]["id"], ) @@ -96,7 +98,7 @@ class PullRequestAssignedResetV1(PagureMessage): return "{username} reset the assignee of the pull-request {name}#{id}".format( name=self.body["pullrequest"]["project"]["fullname"], id=self.body["pullrequest"]["id"], - username=self.body["agent"], + username=self.body["agent_name"], ) @property @@ -119,26 +121,29 @@ class PullRequestClosedV1(PagureMessage): "type": "object", "properties": { "agent": {"type": "string"}, + "agent_name": {"type": "string"}, "pullrequest": PULL_REQUEST, "merged": {"type": "boolean"}, }, - "required": ["agent", "pullrequest", "merged"], + "required": ["agent_name", "pullrequest", "merged"], } def __str__(self): """Return a complete human-readable representation of the message.""" - return "Pull-Request: {fullname}#{id} has been {action}\nBy: {agent}".format( - fullname=self.body["pullrequest"]["project"]["fullname"], - id=self.body["pullrequest"]["id"], - agent=self.body["agent"], - action="merged" if self.body["merged"] else "closed without merging", + return ( + "Pull-Request: {fullname}#{id} has been {action}\nBy: {agent_name}".format( + fullname=self.body["pullrequest"]["project"]["fullname"], + id=self.body["pullrequest"]["id"], + agent_name=self.body["agent_name"], + action="merged" if self.body["merged"] else "closed without merging", + ) ) @property def summary(self): """Return a summary of the message.""" - return "{agent} {action} the pull-request {name}#{id}".format( - agent=self.body["agent"], + return "{agent_name} {action} the pull-request {name}#{id}".format( + agent_name=self.body["agent_name"], name=self.body["pullrequest"]["project"]["fullname"], id=self.body["pullrequest"]["id"], action="merged" if self.body["merged"] else "closed without merging", @@ -164,24 +169,27 @@ class PullRequestCommentAddedV1(PagureMessage): "type": "object", "properties": { "agent": {"type": "string"}, + "agent_name": {"type": "string"}, "pullrequest": PULL_REQUEST, }, - "required": ["agent", "pullrequest"], + "required": ["agent_name", "pullrequest"], } def __str__(self): """Return a complete human-readable representation of the message.""" - return "Pull-Request: {fullname}#{id} has a new comment\nBy: {agent}".format( - fullname=self.body["pullrequest"]["project"]["fullname"], - id=self.body["pullrequest"]["id"], - agent=self.body["agent"], + return ( + "Pull-Request: {fullname}#{id} has a new comment\nBy: {agent_name}".format( + fullname=self.body["pullrequest"]["project"]["fullname"], + id=self.body["pullrequest"]["id"], + agent_name=self.body["agent_name"], + ) ) @property def summary(self): """Return a summary of the message.""" - return "{agent} commented on the pull-request {name}#{id}".format( - agent=self.body["agent"], + return "{agent_name} commented on the pull-request {name}#{id}".format( + agent_name=self.body["agent_name"], name=self.body["pullrequest"]["project"]["fullname"], id=self.body["pullrequest"]["id"], ) @@ -211,24 +219,27 @@ class PullRequestCommentEditedV1(PagureMessage): "type": "object", "properties": { "agent": {"type": "string"}, + "agent_name": {"type": "string"}, "pullrequest": PULL_REQUEST, }, - "required": ["agent", "pullrequest"], + "required": ["agent_name", "pullrequest"], } def __str__(self): """Return a complete human-readable representation of the message.""" - return "Edited comment on Pull-Request: {fullname}#{id}\nBy: {agent}".format( - fullname=self.body["pullrequest"]["project"]["fullname"], - id=self.body["pullrequest"]["id"], - agent=self.body["agent"], + return ( + "Edited comment on Pull-Request: {fullname}#{id}\nBy: {agent_name}".format( + fullname=self.body["pullrequest"]["project"]["fullname"], + id=self.body["pullrequest"]["id"], + agent_name=self.body["agent_name"], + ) ) @property def summary(self): """Return a summary of the message.""" - return "{agent} edited comment on the pull-request {name}#{id}".format( - agent=self.body["agent"], + return "{agent_name} edited comment on the pull-request {name}#{id}".format( + agent_name=self.body["agent_name"], name=self.body["pullrequest"]["project"]["fullname"], id=self.body["pullrequest"]["id"], ) @@ -258,16 +269,17 @@ class PullRequestFlagAddedV1(PagureMessage): "type": "object", "properties": { "agent": {"type": "string"}, + "agent_name": {"type": "string"}, "pullrequest": PULL_REQUEST, "flag": COMMIT_FLAG, }, - "required": ["agent", "pullrequest", "flag"], + "required": ["agent_name", "pullrequest", "flag"], } def __str__(self): """Return a complete human-readable representation of the message.""" - return "New pull-request flag: {username} {status}\nBy: {agent}".format( - agent=self.body["agent"], + return "New pull-request flag: {username} {status}\nBy: {agent_name}".format( + agent_name=self.body["agent_name"], username=self.body["flag"]["username"], status=self.body["flag"]["status"], ) @@ -302,18 +314,21 @@ class PullRequestFlagUpdatedV1(PagureMessage): "type": "object", "properties": { "agent": {"type": "string"}, + "agent_name": {"type": "string"}, "pullrequest": PULL_REQUEST, "flag": COMMIT_FLAG, }, - "required": ["agent", "pullrequest", "flag"], + "required": ["agent_name", "pullrequest", "flag"], } def __str__(self): """Return a complete human-readable representation of the message.""" - return "Pull-request flag updated: {username} {status}\nBy: {agent}".format( - agent=self.body["agent"], - username=self.body["flag"]["username"], - status=self.body["flag"]["status"], + return ( + "Pull-request flag updated: {username} {status}\nBy: {agent_name}".format( + agent_name=self.body["agent_name"], + username=self.body["flag"]["username"], + status=self.body["flag"]["status"], + ) ) @property @@ -346,18 +361,21 @@ class PullRequestInitialCommentEditedV1(PagureMessage): "type": "object", "properties": { "agent": {"type": "string"}, + "agent_name": {"type": "string"}, "project": PROJECT, "pullrequest": PULL_REQUEST, }, - "required": ["agent", "pullrequest", "project"], + "required": ["agent_name", "pullrequest", "project"], } def __str__(self): """Return a complete human-readable representation of the message.""" - return "Description of pull-request {name}#{id} edited\nBy: {agent}".format( - agent=self.body["agent"], - name=self.body["pullrequest"]["project"]["fullname"], - id=self.body["pullrequest"]["id"], + return ( + "Description of pull-request {name}#{id} edited\nBy: {agent_name}".format( + agent_name=self.body["agent_name"], + name=self.body["pullrequest"]["project"]["fullname"], + id=self.body["pullrequest"]["id"], + ) ) @property @@ -366,7 +384,7 @@ class PullRequestInitialCommentEditedV1(PagureMessage): return "{username} has edited the description of the pull-request {name}#{id}".format( name=self.body["pullrequest"]["project"]["fullname"], id=self.body["pullrequest"]["id"], - username=self.body["agent"], + username=self.body["agent_name"], ) @property @@ -389,24 +407,25 @@ class PullRequestNewV1(PagureMessage): "type": "object", "properties": { "agent": {"type": "string"}, + "agent_name": {"type": "string"}, "pullrequest": PULL_REQUEST, }, - "required": ["agent", "pullrequest"], + "required": ["agent_name", "pullrequest"], } def __str__(self): """Return a complete human-readable representation of the message.""" - return "New Pull-Request: {fullname}#{id}\nBy: {agent}".format( + return "New Pull-Request: {fullname}#{id}\nBy: {agent_name}".format( fullname=self.body["pullrequest"]["project"]["fullname"], id=self.body["pullrequest"]["id"], - agent=self.body["agent"], + agent_name=self.body["agent_name"], ) @property def summary(self): """Return a summary of the message.""" - return "{agent} opened a pull-request {fullname}#{id}: {title}".format( - agent=self.body["agent"], + return "{agent_name} opened a pull-request {fullname}#{id}: {title}".format( + agent_name=self.body["agent_name"], fullname=self.body["pullrequest"]["project"]["fullname"], id=self.body["pullrequest"]["id"], title=self.body["pullrequest"]["title"], @@ -432,15 +451,16 @@ class PullRequestRebasedV1(PagureMessage): "type": "object", "properties": { "agent": {"type": "string"}, + "agent_name": {"type": "string"}, "pullrequest": PULL_REQUEST, }, - "required": ["agent", "pullrequest"], + "required": ["agent_name", "pullrequest"], } def __str__(self): """Return a complete human-readable representation of the message.""" - return "Pull-request {name}#{id} was rebased\nBy: {agent}".format( - agent=self.body["agent"], + return "Pull-request {name}#{id} was rebased\nBy: {agent_name}".format( + agent_name=self.body["agent_name"], name=self.body["pullrequest"]["project"]["fullname"], id=self.body["pullrequest"]["id"], ) @@ -451,7 +471,7 @@ class PullRequestRebasedV1(PagureMessage): return "{username} rebased the pull-request {name}#{id}".format( name=self.body["pullrequest"]["project"]["fullname"], id=self.body["pullrequest"]["id"], - username=self.body["agent"], + username=self.body["agent_name"], ) @property @@ -474,15 +494,16 @@ class PullRequestReopenedV1(PagureMessage): "type": "object", "properties": { "agent": {"type": "string"}, + "agent_name": {"type": "string"}, "pullrequest": PULL_REQUEST, }, - "required": ["agent", "pullrequest"], + "required": ["agent_name", "pullrequest"], } def __str__(self): """Return a complete human-readable representation of the message.""" - return "Pull-request {name}#{id} was re-opened\nBy: {agent}".format( - agent=self.body["agent"], + return "Pull-request {name}#{id} was re-opened\nBy: {agent_name}".format( + agent_name=self.body["agent_name"], name=self.body["pullrequest"]["project"]["fullname"], id=self.body["pullrequest"]["id"], ) @@ -493,7 +514,7 @@ class PullRequestReopenedV1(PagureMessage): return "{username} re-opened the pull-request {name}#{id}".format( name=self.body["pullrequest"]["project"]["fullname"], id=self.body["pullrequest"]["id"], - username=self.body["agent"], + username=self.body["agent_name"], ) @property @@ -516,17 +537,18 @@ class PullRequestTagAddedV1(PagureMessage): "type": "object", "properties": { "agent": {"type": "string"}, + "agent_name": {"type": "string"}, "pullrequest": PULL_REQUEST, "project": PROJECT, "tags": {"type": "array", "items": {"type": "string"}}, }, - "required": ["agent", "pullrequest", "project", "tags"], + "required": ["agent_name", "pullrequest", "project", "tags"], } def __str__(self): """Return a complete human-readable representation of the message.""" - return "Pull-request {name}#{id} was tagged\nBy: {agent}".format( - agent=self.body["agent"], + return "Pull-request {name}#{id} was tagged\nBy: {agent_name}".format( + agent_name=self.body["agent_name"], name=self.body["pullrequest"]["project"]["fullname"], id=self.body["pullrequest"]["id"], ) @@ -537,7 +559,7 @@ class PullRequestTagAddedV1(PagureMessage): return "{username} tagged the pull-request {name}#{id} with {tags}".format( name=self.body["pullrequest"]["project"]["fullname"], id=self.body["pullrequest"]["id"], - username=self.body["agent"], + username=self.body["agent_name"], tags=", ".join(self.body["tags"]), ) @@ -561,17 +583,18 @@ class PullRequestTagRemovedV1(PagureMessage): "type": "object", "properties": { "agent": {"type": "string"}, + "agent_name": {"type": "string"}, "pullrequest": PULL_REQUEST, "project": PROJECT, "tags": {"type": "array", "items": {"type": "string"}}, }, - "required": ["agent", "pullrequest", "project", "tags"], + "required": ["agent_name", "pullrequest", "project", "tags"], } def __str__(self): """Return a complete human-readable representation of the message.""" - return "Pull-request {name}#{id} was un-tagged\nBy: {agent}".format( - agent=self.body["agent"], + return "Pull-request {name}#{id} was un-tagged\nBy: {agent_name}".format( + agent_name=self.body["agent_name"], name=self.body["pullrequest"]["project"]["fullname"], id=self.body["pullrequest"]["id"], ) @@ -582,7 +605,7 @@ class PullRequestTagRemovedV1(PagureMessage): return "{username} un-tagged the pull-request {name}#{id} with: {tags}".format( name=self.body["pullrequest"]["project"]["fullname"], id=self.body["pullrequest"]["id"], - username=self.body["agent"], + username=self.body["agent_name"], tags=", ".join(self.body["tags"]), ) @@ -606,15 +629,16 @@ class PullRequestUpdatedV1(PagureMessage): "type": "object", "properties": { "agent": {"type": "string"}, + "agent_name": {"type": "string"}, "pullrequest": PULL_REQUEST, }, - "required": ["agent", "pullrequest"], + "required": ["agent_name", "pullrequest"], } def __str__(self): """Return a complete human-readable representation of the message.""" - return "Pull-request {name}#{id} was updated\nBy: {agent}".format( - agent=self.body["agent"], + return "Pull-request {name}#{id} was updated\nBy: {agent_name}".format( + agent_name=self.body["agent_name"], name=self.body["pullrequest"]["project"]["fullname"], id=self.body["pullrequest"]["id"], ) @@ -625,7 +649,7 @@ class PullRequestUpdatedV1(PagureMessage): return "{username} updated the pull-request {name}#{id}".format( name=self.body["pullrequest"]["project"]["fullname"], id=self.body["pullrequest"]["id"], - username=self.body["agent"], + username=self.body["agent_name"], ) @property diff --git a/pagure_messages/tests/test_commit_flag_added.py b/pagure_messages/tests/test_commit_flag_added.py index 8173611..38fcfef 100644 --- a/pagure_messages/tests/test_commit_flag_added.py +++ b/pagure_messages/tests/test_commit_flag_added.py @@ -29,7 +29,7 @@ def test_minimal(): Assert the message schema validates a message with the required fields. """ body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "repo": PROJECT, "flag": COMMIT_FLAG, } @@ -55,7 +55,7 @@ def test_missing_fields(): def test_str(): """Assert __str__ produces a human-readable message.""" body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "repo": PROJECT, "flag": COMMIT_FLAG, } @@ -68,7 +68,7 @@ def test_str(): def test_summary(): """Assert the summary is correct.""" body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "repo": PROJECT, "flag": COMMIT_FLAG, } diff --git a/pagure_messages/tests/test_commit_flag_updated.py b/pagure_messages/tests/test_commit_flag_updated.py index 37c7887..f11831f 100644 --- a/pagure_messages/tests/test_commit_flag_updated.py +++ b/pagure_messages/tests/test_commit_flag_updated.py @@ -29,7 +29,7 @@ def test_minimal(): Assert the message schema validates a message with the required fields. """ body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "repo": PROJECT, "flag": COMMIT_FLAG, } @@ -55,7 +55,7 @@ def test_missing_fields(): def test_str(): """Assert __str__ produces a human-readable message.""" body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "repo": PROJECT, "flag": COMMIT_FLAG, } @@ -68,7 +68,7 @@ def test_str(): def test_summary(): """Assert the summary is correct.""" body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "repo": PROJECT, "flag": COMMIT_FLAG, } diff --git a/pagure_messages/tests/test_common.py b/pagure_messages/tests/test_common.py index 1d73e16..4fa53aa 100644 --- a/pagure_messages/tests/test_common.py +++ b/pagure_messages/tests/test_common.py @@ -15,6 +15,7 @@ # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. """Unit tests for common properties of the message schemas.""" +import pytest from .utils import PROJECT from ..project_schema import ProjectNewV1 @@ -23,17 +24,24 @@ from ..project_schema import ProjectNewV1 def test_properties(): """Assert some properties are correct.""" body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "project": PROJECT, } message = ProjectNewV1(body=body) assert message.app_name == "pagure" assert message.app_icon == "https://apps.fedoraproject.org/img/icons/pagure.png" - assert message.agent == "dummy-user" + assert message.agent_name == "dummy-user" assert message.agent_avatar == ( "https://seccdn.libravatar.org/avatar/" "18e8268125372e35f95ef082fd124e9274d46916efe2277417fa5fecfee31af1" "?s=64&d=retro" ) assert message.usernames == ["dummy-user"] + with pytest.warns(DeprecationWarning) as w: + assert message.agent == "dummy-user" + assert len(w) == 1 + assert ( + w[0].message.args[0] + == "agent property is deprecated, please use agent_name instead" + ) diff --git a/pagure_messages/tests/test_git_branch_creation.py b/pagure_messages/tests/test_git_branch_creation.py index 43df6a0..0ce67a2 100644 --- a/pagure_messages/tests/test_git_branch_creation.py +++ b/pagure_messages/tests/test_git_branch_creation.py @@ -29,7 +29,7 @@ def test_minimal(): Assert the message schema validates a message with the required fields. """ body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "repo": PROJECT, "branch": "refs/heads/feature/awesome", "rev": "hash_commit", @@ -55,7 +55,7 @@ def test_minimal_short_branch(): Assert the message schema validates a message with the required fields. """ body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "repo": PROJECT, "branch": "feature/awesome", "rev": "hash_commit", @@ -99,7 +99,7 @@ def test_missing_fields(): def test_str(): """Assert __str__ produces a human-readable message.""" body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "repo": PROJECT, "branch": "feature/awesome", "rev": "hash_commit", @@ -121,7 +121,7 @@ def test_str(): def test_summary(): """Assert the summary is correct.""" body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "repo": PROJECT, "branch": "feature/awesome", "rev": "hash_commit", diff --git a/pagure_messages/tests/test_git_branch_deletion.py b/pagure_messages/tests/test_git_branch_deletion.py index 8903be4..8226b3c 100644 --- a/pagure_messages/tests/test_git_branch_deletion.py +++ b/pagure_messages/tests/test_git_branch_deletion.py @@ -29,7 +29,7 @@ def test_minimal(): Assert the message schema validates a message with the required fields. """ body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "repo": PROJECT, "branch": "feature/awesome", "rev": "hash_commit", @@ -70,7 +70,7 @@ def test_missing_fields(): def test_str(): """Assert __str__ produces a human-readable message.""" body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "repo": PROJECT, "branch": "feature/awesome", "rev": "hash_commit", @@ -92,7 +92,7 @@ def test_str(): def test_summary(): """Assert the summary is correct.""" body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "repo": PROJECT, "branch": "feature/awesome", "rev": "hash_commit", diff --git a/pagure_messages/tests/test_git_receive.py b/pagure_messages/tests/test_git_receive.py index 166ff36..97eabf3 100644 --- a/pagure_messages/tests/test_git_receive.py +++ b/pagure_messages/tests/test_git_receive.py @@ -29,7 +29,7 @@ def test_minimal(): Assert the message schema validates a message with the required fields. """ body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "forced": False, "repo": PROJECT, "old_commit": "hash_commit_old", @@ -56,7 +56,7 @@ def test_minimal_short_branch(): Assert the message schema validates a message with the required fields. """ body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "forced": False, "repo": PROJECT, "old_commit": "hash_commit_old", @@ -105,7 +105,7 @@ def test_missing_fields(): def test_str(): """Assert __str__ produces a human-readable message.""" body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "forced": False, "repo": PROJECT, "old_commit": "hash_commit_old", @@ -131,7 +131,7 @@ def test_str(): def test_summary(): """Assert the summary is correct.""" body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "forced": False, "repo": PROJECT, "old_commit": "hash_commit_old", diff --git a/pagure_messages/tests/test_git_tag_creation.py b/pagure_messages/tests/test_git_tag_creation.py index f0b0e38..99851a5 100644 --- a/pagure_messages/tests/test_git_tag_creation.py +++ b/pagure_messages/tests/test_git_tag_creation.py @@ -29,7 +29,7 @@ def test_minimal(): Assert the message schema validates a message with the required fields. """ body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "repo": PROJECT, "tag": "0.0.1", "rev": "hash_commit", @@ -72,7 +72,7 @@ def test_missing_fields(): def test_str(): """Assert __str__ produces a human-readable message.""" body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "repo": PROJECT, "tag": "0.0.1", "rev": "hash_commit", @@ -94,7 +94,7 @@ def test_str(): def test_summary(): """Assert the summary is correct.""" body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "repo": PROJECT, "tag": "0.0.1", "rev": "hash_commit", diff --git a/pagure_messages/tests/test_git_tag_deletion.py b/pagure_messages/tests/test_git_tag_deletion.py index 465c79f..fbd235b 100644 --- a/pagure_messages/tests/test_git_tag_deletion.py +++ b/pagure_messages/tests/test_git_tag_deletion.py @@ -29,7 +29,7 @@ def test_minimal(): Assert the message schema validates a message with the required fields. """ body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "repo": PROJECT, "tag": "0.0.1", "rev": "hash_commit", @@ -70,7 +70,7 @@ def test_missing_fields(): def test_str(): """Assert __str__ produces a human-readable message.""" body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "repo": PROJECT, "tag": "0.0.1", "rev": "hash_commit", @@ -92,7 +92,7 @@ def test_str(): def test_summary(): """Assert the summary is correct.""" body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "repo": PROJECT, "tag": "0.0.1", "rev": "hash_commit", diff --git a/pagure_messages/tests/test_group_edit.py b/pagure_messages/tests/test_group_edit.py index db31a3d..d4a1cd4 100644 --- a/pagure_messages/tests/test_group_edit.py +++ b/pagure_messages/tests/test_group_edit.py @@ -29,7 +29,7 @@ def test_minimal(): Assert the message schema validates a message with the required fields. """ body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "group": GROUP, "fields": ["display_name", "description"], } @@ -52,7 +52,7 @@ def test_missing_fields(): def test_str(): """Assert __str__ produces a human-readable message.""" body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "group": GROUP, "fields": ["display_name", "description"], } @@ -65,7 +65,7 @@ def test_str(): def test_summary(): """Assert the summary is correct.""" body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "group": GROUP, "fields": ["display_name", "description"], } diff --git a/pagure_messages/tests/test_issue_assigned_added.py b/pagure_messages/tests/test_issue_assigned_added.py index 60b82ab..d36e9f2 100644 --- a/pagure_messages/tests/test_issue_assigned_added.py +++ b/pagure_messages/tests/test_issue_assigned_added.py @@ -29,7 +29,7 @@ def test_minimal(): Assert the message schema validates a message with the required fields. """ body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "project": PROJECT, "issue": ISSUE, } @@ -58,7 +58,7 @@ def test_str(): "name": "foobar", } body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "project": PROJECT, "issue": issue, } @@ -79,7 +79,7 @@ def test_summary(): "name": "foobar", } body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "project": PROJECT, "issue": issue, } diff --git a/pagure_messages/tests/test_issue_assigned_reset.py b/pagure_messages/tests/test_issue_assigned_reset.py index 6576917..99b14b7 100644 --- a/pagure_messages/tests/test_issue_assigned_reset.py +++ b/pagure_messages/tests/test_issue_assigned_reset.py @@ -29,7 +29,7 @@ def test_minimal(): Assert the message schema validates a message with the required fields. """ body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "project": PROJECT, "issue": ISSUE, } @@ -52,7 +52,7 @@ def test_missing_fields(): def test_str(): """Assert __str__ produces a human-readable message.""" body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "project": PROJECT, "issue": ISSUE, } @@ -67,7 +67,7 @@ def test_str(): def test_summary(): """Assert the summary is correct.""" body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "project": PROJECT, "issue": ISSUE, } diff --git a/pagure_messages/tests/test_issue_comment_added.py b/pagure_messages/tests/test_issue_comment_added.py index 7730920..4274730 100644 --- a/pagure_messages/tests/test_issue_comment_added.py +++ b/pagure_messages/tests/test_issue_comment_added.py @@ -29,7 +29,7 @@ def test_minimal(): Assert the message schema validates a message with the required fields. """ body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "project": PROJECT, "issue": ISSUE, } @@ -52,7 +52,7 @@ def test_missing_fields(): def test_str(): """Assert __str__ produces a human-readable message.""" body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "project": PROJECT, "issue": ISSUE, } @@ -67,7 +67,7 @@ def test_str(): def test_summary(): """Assert the summary is correct.""" body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "project": PROJECT, "issue": ISSUE, } diff --git a/pagure_messages/tests/test_issue_dependency_added.py b/pagure_messages/tests/test_issue_dependency_added.py index 3781c45..e2dd4dc 100644 --- a/pagure_messages/tests/test_issue_dependency_added.py +++ b/pagure_messages/tests/test_issue_dependency_added.py @@ -29,7 +29,7 @@ def test_minimal(): Assert the message schema validates a message with the required fields. """ body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "project": PROJECT, "issue": ISSUE, "added_dependency": 8912, @@ -54,7 +54,7 @@ def test_missing_fields(): def test_str(): """Assert __str__ produces a human-readable message.""" body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "project": PROJECT, "issue": ISSUE, "added_dependency": 8912, @@ -70,7 +70,7 @@ def test_str(): def test_summary(): """Assert the summary is correct.""" body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "project": PROJECT, "issue": ISSUE, "added_dependency": 8912, diff --git a/pagure_messages/tests/test_issue_dependency_removed.py b/pagure_messages/tests/test_issue_dependency_removed.py index c57edf8..3b3a231 100644 --- a/pagure_messages/tests/test_issue_dependency_removed.py +++ b/pagure_messages/tests/test_issue_dependency_removed.py @@ -29,7 +29,7 @@ def test_minimal(): Assert the message schema validates a message with the required fields. """ body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "project": PROJECT, "issue": ISSUE, "removed_dependency": [8912], @@ -54,7 +54,7 @@ def test_missing_fields(): def test_str(): """Assert __str__ produces a human-readable message.""" body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "project": PROJECT, "issue": ISSUE, "removed_dependency": [8912], @@ -71,7 +71,7 @@ def test_str(): def test_summary(): """Assert the summary is correct.""" body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "project": PROJECT, "issue": ISSUE, "removed_dependency": [8912], diff --git a/pagure_messages/tests/test_issue_drop.py b/pagure_messages/tests/test_issue_drop.py index 470e70c..2d68fea 100644 --- a/pagure_messages/tests/test_issue_drop.py +++ b/pagure_messages/tests/test_issue_drop.py @@ -29,7 +29,7 @@ def test_minimal(): Assert the message schema validates a message with the required fields. """ body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "project": PROJECT, "issue": ISSUE, } @@ -55,7 +55,7 @@ def test_missing_fields(): def test_str(): """Assert __str__ produces a human-readable message.""" body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "project": PROJECT, "issue": ISSUE, } @@ -68,7 +68,7 @@ def test_str(): def test_summary(): """Assert the summary is correct.""" body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "project": PROJECT, "issue": ISSUE, } diff --git a/pagure_messages/tests/test_issue_edit.py b/pagure_messages/tests/test_issue_edit.py index e7d61b3..cb49f88 100644 --- a/pagure_messages/tests/test_issue_edit.py +++ b/pagure_messages/tests/test_issue_edit.py @@ -29,7 +29,7 @@ def test_minimal(): Assert the message schema validates a message with the required fields. """ body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "project": PROJECT, "issue": ISSUE, "fields": ["content"], @@ -54,7 +54,7 @@ def test_missing_fields(): def test_str(): """Assert __str__ produces a human-readable message.""" body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "project": PROJECT, "issue": ISSUE, "fields": ["content"], @@ -68,7 +68,7 @@ def test_str(): def test_summary(): """Assert the summary is correct.""" body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "project": PROJECT, "issue": ISSUE, "fields": ["content"], diff --git a/pagure_messages/tests/test_issue_new.py b/pagure_messages/tests/test_issue_new.py index 70d5293..18374a0 100644 --- a/pagure_messages/tests/test_issue_new.py +++ b/pagure_messages/tests/test_issue_new.py @@ -29,7 +29,7 @@ def test_minimal(): Assert the message schema validates a message with the required fields. """ body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "project": PROJECT, "issue": ISSUE, } @@ -52,7 +52,7 @@ def test_missing_fields(): def test_str(): """Assert __str__ produces a human-readable message.""" body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "project": PROJECT, "issue": ISSUE, } @@ -65,7 +65,7 @@ def test_str(): def test_summary(): """Assert the summary is correct.""" body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "project": PROJECT, "issue": ISSUE, } diff --git a/pagure_messages/tests/test_issue_tag_added.py b/pagure_messages/tests/test_issue_tag_added.py index 19d641a..8b816cf 100644 --- a/pagure_messages/tests/test_issue_tag_added.py +++ b/pagure_messages/tests/test_issue_tag_added.py @@ -29,7 +29,7 @@ def test_minimal(): Assert the message schema validates a message with the required fields. """ body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "project": PROJECT, "issue": ISSUE, "tags": ["blue", "red"], @@ -54,7 +54,7 @@ def test_missing_fields(): def test_str(): """Assert __str__ produces a human-readable message.""" body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "project": PROJECT, "issue": ISSUE, "tags": ["blue", "red"], @@ -68,7 +68,7 @@ def test_str(): def test_summary(): """Assert the summary is correct.""" body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "project": PROJECT, "issue": ISSUE, "tags": ["blue", "red"], diff --git a/pagure_messages/tests/test_issue_tag_removed.py b/pagure_messages/tests/test_issue_tag_removed.py index eda44d1..172d483 100644 --- a/pagure_messages/tests/test_issue_tag_removed.py +++ b/pagure_messages/tests/test_issue_tag_removed.py @@ -29,7 +29,7 @@ def test_minimal(): Assert the message schema validates a message with the required fields. """ body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "project": PROJECT, "issue": ISSUE, "tags": ["blue", "red"], @@ -54,7 +54,7 @@ def test_missing_fields(): def test_str(): """Assert __str__ produces a human-readable message.""" body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "project": PROJECT, "issue": ISSUE, "tags": ["blue", "red"], @@ -71,7 +71,7 @@ def test_str(): def test_summary(): """Assert the summary is correct.""" body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "project": PROJECT, "issue": ISSUE, "tags": ["blue", "red"], diff --git a/pagure_messages/tests/test_project_deleted.py b/pagure_messages/tests/test_project_deleted.py index 2656c56..7f2038e 100644 --- a/pagure_messages/tests/test_project_deleted.py +++ b/pagure_messages/tests/test_project_deleted.py @@ -29,7 +29,7 @@ def test_minimal(): Assert the message schema validates a message with the required fields. """ body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "project": PROJECT, } message = ProjectDeletedV1(body=body) @@ -50,7 +50,7 @@ def test_missing_fields(): def test_str(): """Assert __str__ produces a human-readable message.""" body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "project": PROJECT, } expected_str = "Project: fedora-infra/fedocal-messages\nDeleted by: dummy-user" @@ -62,7 +62,7 @@ def test_str(): def test_summary(): """Assert the summary is correct.""" body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "project": PROJECT, } expected_summary = 'dummy-user deleted project "fedora-infra/fedocal-messages"' diff --git a/pagure_messages/tests/test_project_edit.py b/pagure_messages/tests/test_project_edit.py index da1aa49..99f61b2 100644 --- a/pagure_messages/tests/test_project_edit.py +++ b/pagure_messages/tests/test_project_edit.py @@ -29,7 +29,7 @@ def test_minimal(): Assert the message schema validates a message with the required fields. """ body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "project": PROJECT, "fields": ["pull_requests"], } @@ -52,7 +52,7 @@ def test_missing_fields(): def test_str(): """Assert __str__ produces a human-readable message.""" body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "project": PROJECT, "fields": ["pull_requests"], } @@ -65,7 +65,7 @@ def test_str(): def test_summary(): """Assert the summary is correct.""" body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "project": PROJECT, "fields": ["pull_requests"], } diff --git a/pagure_messages/tests/test_project_forked.py b/pagure_messages/tests/test_project_forked.py index c6062f8..6df4e4e 100644 --- a/pagure_messages/tests/test_project_forked.py +++ b/pagure_messages/tests/test_project_forked.py @@ -29,7 +29,7 @@ def test_minimal(): Assert the message schema validates a message with the required fields. """ body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "project": FORK, } message = ProjectForkedV1(body=body) @@ -50,7 +50,7 @@ def test_missing_fields(): def test_str(): """Assert __str__ produces a human-readable message.""" body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "project": FORK, } expected_str = "Project: pagure\nForked by: dummy-user" @@ -62,7 +62,7 @@ def test_str(): def test_summary(): """Assert the summary is correct.""" body = { - "agent": "jjames", + "agent_name": "jjames", "project": FORK, "fields": ["pull_requests"], } diff --git a/pagure_messages/tests/test_project_group_access_updated.py b/pagure_messages/tests/test_project_group_access_updated.py index 80bb6b0..ad99daa 100644 --- a/pagure_messages/tests/test_project_group_access_updated.py +++ b/pagure_messages/tests/test_project_group_access_updated.py @@ -29,7 +29,7 @@ def test_minimal(): Assert the message schema validates a message with the required fields. """ body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "project": PROJECT, } message = ProjectGroupAccessUpdatedV1(body=body) @@ -50,7 +50,7 @@ def test_missing_fields(): def test_str(): """Assert __str__ produces a human-readable message.""" body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "project": PROJECT, "new_group": "dummy-group", "new_access": "commit", @@ -67,7 +67,7 @@ def test_str(): def test_summary(): """Assert the summary is correct.""" body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "project": PROJECT, "new_group": "dummy-group", "new_access": "commit", diff --git a/pagure_messages/tests/test_project_group_added.py b/pagure_messages/tests/test_project_group_added.py index 27bf1e4..c5d6125 100644 --- a/pagure_messages/tests/test_project_group_added.py +++ b/pagure_messages/tests/test_project_group_added.py @@ -29,7 +29,7 @@ def test_minimal(): Assert the message schema validates a message with the required fields. """ body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "project": PROJECT, } message = ProjectGroupAddedV1(body=body) @@ -50,7 +50,7 @@ def test_missing_fields(): def test_str(): """Assert __str__ produces a human-readable message.""" body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "project": PROJECT, "new_group": "dummy-group", "access": "commit", @@ -67,7 +67,7 @@ def test_str(): def test_summary(): """Assert the summary is correct.""" body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "project": PROJECT, "new_group": "dummy-group", "access": "commit", diff --git a/pagure_messages/tests/test_project_group_removed.py b/pagure_messages/tests/test_project_group_removed.py index 26cf6ae..5a01e16 100644 --- a/pagure_messages/tests/test_project_group_removed.py +++ b/pagure_messages/tests/test_project_group_removed.py @@ -29,7 +29,7 @@ def test_minimal(): Assert the message schema validates a message with the required fields. """ body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "project": PROJECT, } message = ProjectGroupRemovedV1(body=body) @@ -50,7 +50,7 @@ def test_missing_fields(): def test_str(): """Assert __str__ produces a human-readable message.""" body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "project": PROJECT, "new_group": "dummy-group", "access": "commit", @@ -67,7 +67,7 @@ def test_str(): def test_summary(): """Assert the summary is correct.""" body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "project": PROJECT, "new_group": "dummy-group", "access": "commit", diff --git a/pagure_messages/tests/test_project_new.py b/pagure_messages/tests/test_project_new.py index 9de5feb..986d99a 100644 --- a/pagure_messages/tests/test_project_new.py +++ b/pagure_messages/tests/test_project_new.py @@ -29,7 +29,7 @@ def test_minimal(): Assert the message schema validates a message with the required fields. """ body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "project": PROJECT, } message = ProjectNewV1(body=body) @@ -50,7 +50,7 @@ def test_missing_fields(): def test_str(): """Assert __str__ produces a human-readable message.""" body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "project": PROJECT, } expected_str = "New Project: fedora-infra/fedocal-messages\nBy: dummy-user" @@ -62,7 +62,7 @@ def test_str(): def test_summary(): """Assert the summary is correct.""" body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "project": PROJECT, } expected_summary = 'dummy-user created project "fedora-infra/fedocal-messages"' diff --git a/pagure_messages/tests/test_project_tag_edited.py b/pagure_messages/tests/test_project_tag_edited.py index 3a7f2fb..f1659b8 100644 --- a/pagure_messages/tests/test_project_tag_edited.py +++ b/pagure_messages/tests/test_project_tag_edited.py @@ -29,7 +29,7 @@ def test_minimal(): Assert the message schema validates a message with the required fields. """ body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "project": PROJECT, } message = ProjectTagEditedV1(body=body) @@ -50,7 +50,7 @@ def test_missing_fields(): def test_str(): """Assert __str__ produces a human-readable message.""" body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "project": PROJECT, "new_tag": "testing", } @@ -65,7 +65,7 @@ def test_str(): def test_summary(): """Assert the summary is correct.""" body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "project": PROJECT, "new_tag": "testing", } diff --git a/pagure_messages/tests/test_project_tag_removed.py b/pagure_messages/tests/test_project_tag_removed.py index 104e1ce..0fce9d4 100644 --- a/pagure_messages/tests/test_project_tag_removed.py +++ b/pagure_messages/tests/test_project_tag_removed.py @@ -29,7 +29,7 @@ def test_minimal(): Assert the message schema validates a message with the required fields. """ body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "project": PROJECT, } message = ProjectTagRemovedV1(body=body) @@ -50,7 +50,7 @@ def test_missing_fields(): def test_str(): """Assert __str__ produces a human-readable message.""" body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "project": PROJECT, "tags": ["testing"], } @@ -65,7 +65,7 @@ def test_str(): def test_summary(): """Assert the summary is correct.""" body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "project": PROJECT, "tags": ["testing"], } diff --git a/pagure_messages/tests/test_project_user_access_updated.py b/pagure_messages/tests/test_project_user_access_updated.py index 727e477..1139ccb 100644 --- a/pagure_messages/tests/test_project_user_access_updated.py +++ b/pagure_messages/tests/test_project_user_access_updated.py @@ -29,7 +29,7 @@ def test_minimal(): Assert the message schema validates a message with the required fields. """ body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "project": PROJECT, } message = ProjectUserAccessUpdatedV1(body=body) @@ -50,7 +50,7 @@ def test_missing_fields(): def test_str(): """Assert __str__ produces a human-readable message.""" body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "project": PROJECT, "new_user": "newu", "new_access": "commit", @@ -67,7 +67,7 @@ def test_str(): def test_summary(): """Assert the summary is correct.""" body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "project": PROJECT, "new_user": "newu", "new_access": "commit", diff --git a/pagure_messages/tests/test_project_user_added.py b/pagure_messages/tests/test_project_user_added.py index a293397..e0915d5 100644 --- a/pagure_messages/tests/test_project_user_added.py +++ b/pagure_messages/tests/test_project_user_added.py @@ -29,7 +29,7 @@ def test_minimal(): Assert the message schema validates a message with the required fields. """ body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "project": PROJECT, } message = ProjectUserAddedV1(body=body) @@ -50,7 +50,7 @@ def test_missing_fields(): def test_str(): """Assert __str__ produces a human-readable message.""" body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "project": PROJECT, "new_user": "newu", } @@ -63,7 +63,7 @@ def test_str(): def test_summary(): """Assert the summary is correct.""" body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "project": PROJECT, "new_user": "newu", } diff --git a/pagure_messages/tests/test_project_user_removed.py b/pagure_messages/tests/test_project_user_removed.py index f4dbc9d..3b690e9 100644 --- a/pagure_messages/tests/test_project_user_removed.py +++ b/pagure_messages/tests/test_project_user_removed.py @@ -29,7 +29,7 @@ def test_minimal(): Assert the message schema validates a message with the required fields. """ body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "project": PROJECT, } message = ProjectUserRemovedV1(body=body) @@ -50,7 +50,7 @@ def test_missing_fields(): def test_str(): """Assert __str__ produces a human-readable message.""" body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "project": PROJECT, "removed_user": "newu", } @@ -65,7 +65,7 @@ def test_str(): def test_summary(): """Assert the summary is correct.""" body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "project": PROJECT, "removed_user": "newu", } diff --git a/pagure_messages/tests/test_pull_request_assigned_added.py b/pagure_messages/tests/test_pull_request_assigned_added.py index 430c15d..34591b3 100644 --- a/pagure_messages/tests/test_pull_request_assigned_added.py +++ b/pagure_messages/tests/test_pull_request_assigned_added.py @@ -29,7 +29,7 @@ def test_minimal(): Assert the message schema validates a message with the required fields. """ body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "pullrequest": PULL_REQUEST, "project": PROJECT, } @@ -52,7 +52,7 @@ def test_missing_fields(): def test_str(): """Assert __str__ produces a human-readable message.""" body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "pullrequest": PULL_REQUEST, "project": PROJECT, } @@ -71,7 +71,7 @@ def test_summary(): "name": "foobar", } body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "pullrequest": request, "project": PROJECT, } diff --git a/pagure_messages/tests/test_pull_request_assigned_reset.py b/pagure_messages/tests/test_pull_request_assigned_reset.py index c1f352b..2ac1b26 100644 --- a/pagure_messages/tests/test_pull_request_assigned_reset.py +++ b/pagure_messages/tests/test_pull_request_assigned_reset.py @@ -29,7 +29,7 @@ def test_minimal(): Assert the message schema validates a message with the required fields. """ body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "pullrequest": PULL_REQUEST, "project": PROJECT, } @@ -52,7 +52,7 @@ def test_missing_fields(): def test_str(): """Assert __str__ produces a human-readable message.""" body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "pullrequest": PULL_REQUEST, "project": PROJECT, } @@ -65,7 +65,7 @@ def test_str(): def test_summary(): """Assert the summary is correct.""" body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "pullrequest": PULL_REQUEST, "project": PROJECT, } diff --git a/pagure_messages/tests/test_pull_request_closed.py b/pagure_messages/tests/test_pull_request_closed.py index d8e2e6a..079b9a8 100644 --- a/pagure_messages/tests/test_pull_request_closed.py +++ b/pagure_messages/tests/test_pull_request_closed.py @@ -29,7 +29,7 @@ def test_minimal(): Assert the message schema validates a message with the required fields. """ body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "pullrequest": PULL_REQUEST, "merged": False, } @@ -52,7 +52,7 @@ def test_missing_fields(): def test_str_closed(): """Assert __str__ produces a human-readable message.""" body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "pullrequest": PULL_REQUEST, "merged": False, } @@ -67,7 +67,7 @@ def test_str_closed(): def test_summary_closed(): """Assert the summary is correct.""" body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "pullrequest": PULL_REQUEST, "merged": False, } @@ -80,7 +80,7 @@ def test_summary_closed(): def test_str_merged(): """Assert __str__ produces a human-readable message.""" body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "pullrequest": PULL_REQUEST, "merged": True, } @@ -93,7 +93,7 @@ def test_str_merged(): def test_summary_merged(): """Assert the summary is correct.""" body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "pullrequest": PULL_REQUEST, "merged": True, } diff --git a/pagure_messages/tests/test_pull_request_comment_added.py b/pagure_messages/tests/test_pull_request_comment_added.py index 8a960e2..f7c909f 100644 --- a/pagure_messages/tests/test_pull_request_comment_added.py +++ b/pagure_messages/tests/test_pull_request_comment_added.py @@ -29,7 +29,7 @@ def test_minimal(): Assert the message schema validates a message with the required fields. """ body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "pullrequest": PULL_REQUEST, } message = PullRequestCommentAddedV1(body=body) @@ -53,7 +53,7 @@ def test_missing_fields(): def test_str(): """Assert __str__ produces a human-readable message.""" body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "pullrequest": PULL_REQUEST, } expected_str = "Pull-Request: pagure#5014 has a new comment\nBy: dummy-user" @@ -65,7 +65,7 @@ def test_str(): def test_summary(): """Assert the summary is correct.""" body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "pullrequest": PULL_REQUEST, } expected_summary = "dummy-user commented on the pull-request pagure#5014" diff --git a/pagure_messages/tests/test_pull_request_comment_edited.py b/pagure_messages/tests/test_pull_request_comment_edited.py index 40dbba5..242e54c 100644 --- a/pagure_messages/tests/test_pull_request_comment_edited.py +++ b/pagure_messages/tests/test_pull_request_comment_edited.py @@ -29,7 +29,7 @@ def test_minimal(): Assert the message schema validates a message with the required fields. """ body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "pullrequest": PULL_REQUEST, } message = PullRequestCommentEditedV1(body=body) @@ -53,7 +53,7 @@ def test_missing_fields(): def test_str(): """Assert __str__ produces a human-readable message.""" body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "pullrequest": PULL_REQUEST, } expected_str = "Edited comment on Pull-Request: pagure#5014\nBy: dummy-user" @@ -65,7 +65,7 @@ def test_str(): def test_summary(): """Assert the summary is correct.""" body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "pullrequest": PULL_REQUEST, } expected_summary = "dummy-user edited comment on the pull-request pagure#5014" diff --git a/pagure_messages/tests/test_pull_request_flag_added.py b/pagure_messages/tests/test_pull_request_flag_added.py index bd883ca..c7a7b4c 100644 --- a/pagure_messages/tests/test_pull_request_flag_added.py +++ b/pagure_messages/tests/test_pull_request_flag_added.py @@ -29,7 +29,7 @@ def test_minimal(): Assert the message schema validates a message with the required fields. """ body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "pullrequest": PULL_REQUEST, "flag": COMMIT_FLAG, } @@ -52,7 +52,7 @@ def test_missing_fields(): def test_str(): """Assert __str__ produces a human-readable message.""" body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "pullrequest": PULL_REQUEST, "flag": COMMIT_FLAG, } @@ -65,7 +65,7 @@ def test_str(): def test_summary(): """Assert the summary is correct.""" body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "pullrequest": PULL_REQUEST, "flag": COMMIT_FLAG, } diff --git a/pagure_messages/tests/test_pull_request_flag_updated.py b/pagure_messages/tests/test_pull_request_flag_updated.py index 3058b57..030f36f 100644 --- a/pagure_messages/tests/test_pull_request_flag_updated.py +++ b/pagure_messages/tests/test_pull_request_flag_updated.py @@ -29,7 +29,7 @@ def test_minimal(): Assert the message schema validates a message with the required fields. """ body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "pullrequest": PULL_REQUEST, "flag": COMMIT_FLAG, } @@ -52,7 +52,7 @@ def test_missing_fields(): def test_str(): """Assert __str__ produces a human-readable message.""" body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "pullrequest": PULL_REQUEST, "flag": COMMIT_FLAG, } @@ -65,7 +65,7 @@ def test_str(): def test_summary(): """Assert the summary is correct.""" body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "pullrequest": PULL_REQUEST, "flag": COMMIT_FLAG, } diff --git a/pagure_messages/tests/test_pull_request_initial_comment_edited.py b/pagure_messages/tests/test_pull_request_initial_comment_edited.py index 3d11cb5..74eba9b 100644 --- a/pagure_messages/tests/test_pull_request_initial_comment_edited.py +++ b/pagure_messages/tests/test_pull_request_initial_comment_edited.py @@ -29,7 +29,7 @@ def test_minimal(): Assert the message schema validates a message with the required fields. """ body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "project": PROJECT, "pullrequest": PULL_REQUEST, } @@ -52,7 +52,7 @@ def test_missing_fields(): def test_str(): """Assert __str__ produces a human-readable message.""" body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "project": PROJECT, "pullrequest": PULL_REQUEST, } @@ -65,7 +65,7 @@ def test_str(): def test_summary(): """Assert the summary is correct.""" body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "project": PROJECT, "pullrequest": PULL_REQUEST, } diff --git a/pagure_messages/tests/test_pull_request_new.py b/pagure_messages/tests/test_pull_request_new.py index 3a519cb..b72f8d9 100644 --- a/pagure_messages/tests/test_pull_request_new.py +++ b/pagure_messages/tests/test_pull_request_new.py @@ -29,7 +29,7 @@ def test_minimal(): Assert the message schema validates a message with the required fields. """ body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "pullrequest": PULL_REQUEST, } message = PullRequestNewV1(body=body) @@ -50,7 +50,7 @@ def test_missing_fields(): def test_str(): """Assert __str__ produces a human-readable message.""" body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "pullrequest": PULL_REQUEST, } expected_str = "New Pull-Request: pagure#5014\nBy: dummy-user" @@ -62,7 +62,7 @@ def test_str(): def test_summary(): """Assert the summary is correct.""" body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "pullrequest": PULL_REQUEST, } expected_summary = ( diff --git a/pagure_messages/tests/test_pull_request_rebased.py b/pagure_messages/tests/test_pull_request_rebased.py index 4f7c3cb..e089ae5 100644 --- a/pagure_messages/tests/test_pull_request_rebased.py +++ b/pagure_messages/tests/test_pull_request_rebased.py @@ -29,7 +29,7 @@ def test_minimal(): Assert the message schema validates a message with the required fields. """ body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "pullrequest": PULL_REQUEST, } message = PullRequestRebasedV1(body=body) @@ -50,7 +50,7 @@ def test_missing_fields(): def test_str(): """Assert __str__ produces a human-readable message.""" body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "pullrequest": PULL_REQUEST, } expected_str = "Pull-request pagure#5014 was rebased\nBy: dummy-user" @@ -62,7 +62,7 @@ def test_str(): def test_summary(): """Assert the summary is correct.""" body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "pullrequest": PULL_REQUEST, } expected_summary = "dummy-user rebased the pull-request pagure#5014" diff --git a/pagure_messages/tests/test_pull_request_reopened.py b/pagure_messages/tests/test_pull_request_reopened.py index 8b7f0ad..1846e85 100644 --- a/pagure_messages/tests/test_pull_request_reopened.py +++ b/pagure_messages/tests/test_pull_request_reopened.py @@ -29,7 +29,7 @@ def test_minimal(): Assert the message schema validates a message with the required fields. """ body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "pullrequest": PULL_REQUEST, } message = PullRequestReopenedV1(body=body) @@ -50,7 +50,7 @@ def test_missing_fields(): def test_str(): """Assert __str__ produces a human-readable message.""" body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "pullrequest": PULL_REQUEST, } expected_str = "Pull-request pagure#5014 was re-opened\nBy: dummy-user" @@ -62,7 +62,7 @@ def test_str(): def test_summary(): """Assert the summary is correct.""" body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "pullrequest": PULL_REQUEST, } expected_summary = "dummy-user re-opened the pull-request pagure#5014" diff --git a/pagure_messages/tests/test_pull_request_tag_added.py b/pagure_messages/tests/test_pull_request_tag_added.py index 418946b..4c489ec 100644 --- a/pagure_messages/tests/test_pull_request_tag_added.py +++ b/pagure_messages/tests/test_pull_request_tag_added.py @@ -29,7 +29,7 @@ def test_minimal(): Assert the message schema validates a message with the required fields. """ body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "pullrequest": PULL_REQUEST, "project": PROJECT, "tags": ["blue", "red"], @@ -54,7 +54,7 @@ def test_missing_fields(): def test_str(): """Assert __str__ produces a human-readable message.""" body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "pullrequest": PULL_REQUEST, "project": PROJECT, "tags": ["blue", "red"], @@ -68,7 +68,7 @@ def test_str(): def test_summary(): """Assert the summary is correct.""" body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "pullrequest": PULL_REQUEST, "project": PROJECT, "tags": ["blue", "red"], diff --git a/pagure_messages/tests/test_pull_request_tag_removed.py b/pagure_messages/tests/test_pull_request_tag_removed.py index ec76a86..c591330 100644 --- a/pagure_messages/tests/test_pull_request_tag_removed.py +++ b/pagure_messages/tests/test_pull_request_tag_removed.py @@ -29,7 +29,7 @@ def test_minimal(): Assert the message schema validates a message with the required fields. """ body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "pullrequest": PULL_REQUEST, "project": PROJECT, "tags": ["blue", "red"], @@ -54,7 +54,7 @@ def test_missing_fields(): def test_str(): """Assert __str__ produces a human-readable message.""" body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "pullrequest": PULL_REQUEST, "project": PROJECT, "tags": ["blue", "red"], @@ -68,7 +68,7 @@ def test_str(): def test_summary(): """Assert the summary is correct.""" body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "pullrequest": PULL_REQUEST, "project": PROJECT, "tags": ["blue", "red"], diff --git a/pagure_messages/tests/test_pull_request_updated.py b/pagure_messages/tests/test_pull_request_updated.py index 550836d..25d139b 100644 --- a/pagure_messages/tests/test_pull_request_updated.py +++ b/pagure_messages/tests/test_pull_request_updated.py @@ -29,7 +29,7 @@ def test_minimal(): Assert the message schema validates a message with the required fields. """ body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "pullrequest": PULL_REQUEST, } message = PullRequestUpdatedV1(body=body) @@ -50,7 +50,7 @@ def test_missing_fields(): def test_str(): """Assert __str__ produces a human-readable message.""" body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "pullrequest": PULL_REQUEST, } expected_str = "Pull-request pagure#5014 was updated\nBy: dummy-user" @@ -62,7 +62,7 @@ def test_str(): def test_summary(): """Assert the summary is correct.""" body = { - "agent": "dummy-user", + "agent_name": "dummy-user", "pullrequest": PULL_REQUEST, } expected_summary = "dummy-user updated the pull-request pagure#5014"