From 4f46090ddb15c676b51b5b8537220612349b6a68 Mon Sep 17 00:00:00 2001 From: Ralph Bean Date: Tue, 24 Feb 2015 16:20:12 -0500 Subject: [PATCH 1/2] Make github longform tests conditional. --- .../tests/github.py | 28 ++++++++++++------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/fedmsg_meta_fedora_infrastructure/tests/github.py b/fedmsg_meta_fedora_infrastructure/tests/github.py index ab7a13f..0750022 100644 --- a/fedmsg_meta_fedora_infrastructure/tests/github.py +++ b/fedmsg_meta_fedora_infrastructure/tests/github.py @@ -19,6 +19,7 @@ # """ Tests for github2fedmsg messages """ +import os import unittest from fedmsg_meta_fedora_infrastructure.tests.base import Base @@ -101,7 +102,6 @@ class TestGithubPush(Base): expected_title = "github.push" expected_subti = 'ralph pushed 1 commit(s) to fedora-infra/github2fedmsg' - expected_long_form = expected_subti + "\n\n" + full_patch1 expected_link = "https://github.com/fedora-infra/github2fedmsg/" + \ "compare/60a6d3eb508c...404a417299f8" expected_icon = "https://apps.fedoraproject.org/img/icons/github.png" @@ -229,8 +229,6 @@ class TestGithubIssue(Base): expected_title = "github.issue.reopened" expected_subti = 'ralph reopened issue #3 on fedora-infra/github2fedmsg' - expected_long_form = expected_subti + "\n\n" + \ - "Testing stuff." expected_link = "https://github.com/fedora-infra/github2fedmsg/issues/3" expected_icon = "https://apps.fedoraproject.org/img/icons/github.png" expected_secondary_icon = ( @@ -347,8 +345,6 @@ class TestGithubIssueComment(Base): expected_title = "github.issue.comment" expected_subti = 'ralph commented on issue #3 on ' + \ 'fedora-infra/github2fedmsg' - expected_long_form = expected_subti + "\n\n" + \ - "This issue is super great!" expected_link = "https://github.com/fedora-infra/github2fedmsg/" + \ "issues/3#issuecomment-37971221" expected_icon = "https://apps.fedoraproject.org/img/icons/github.png" @@ -1178,8 +1174,6 @@ class TestGithubPullRequestComment(Base): expected_title = "github.pull_request_review_comment" expected_subti = 'pingou commented on PR #129 on fedora-infra/fedocal' - expected_long_form = expected_subti + "\n\n" + \ - "I was thinking the ``flask.request.args.get(..." expected_link = "https://github.com/fedora-infra/fedocal/" + \ "pull/129#discussion_r13957675" expected_icon = "https://apps.fedoraproject.org/img/icons/github.png" @@ -1420,9 +1414,6 @@ class TestGithubCommitComment(Base): expected_title = "github.commit_comment" expected_subti = "ralph commented on a commit on fedora-infra/bodhi" - expected_long_form = expected_subti + "\n\n" + \ - "Maybe add a ``# comment`` here that 'BUILD_ID' " + \ - "is from jenkins and link to http://da.gd/QuQs ?" expected_link = "https://github.com/fedora-infra/bodhi/commit/" + \ "425c3610e129138a8b918b1eb1a40d291da20dc5" + \ "#commitcomment-6733053" @@ -1844,6 +1835,23 @@ class TestGithubRelease(Base): } +if not 'FEDMSG_META_NO_NETWORK' in os.environ: + TestGithubPush.expected_long_form = \ + TestGithubPush.expected_subti + "\n\n" + full_patch1 + TestGithubIssue.expected_long_form = \ + TestGithubIssue.expected_subti + "\n\n" + "Testing stuff." + TestGithubIssueComment.expected_long_form = \ + TestGithubIssueComment.expected_subti + "\n\n" + \ + "This issue is super great!" + TestGithubPullRequestComment.expected_long_form = \ + TestGithubPullRequestComment.expected_subti + "\n\n" + \ + "I was thinking the ``flask.request.args.get(..." + TestGithubCommitComment.expected_long_form = \ + TestGithubCommitComment.expected_subti + "\n\n" + \ + "Maybe add a ``# comment`` here that 'BUILD_ID' " + \ + "is from jenkins and link to http://da.gd/QuQs ?" + + add_doc(locals()) if __name__ == '__main__': From 0a99a6226856c77ec35eb18a9e12eda7fa0d69b0 Mon Sep 17 00:00:00 2001 From: Ralph Bean Date: Tue, 24 Feb 2015 16:24:55 -0500 Subject: [PATCH 2/2] Move zodbot tests to their own file, and make the long_form part conditional like the others. --- .../tests/__init__.py | 353 +--------------- .../tests/zodbot.py | 389 ++++++++++++++++++ 2 files changed, 390 insertions(+), 352 deletions(-) create mode 100644 fedmsg_meta_fedora_infrastructure/tests/zodbot.py diff --git a/fedmsg_meta_fedora_infrastructure/tests/__init__.py b/fedmsg_meta_fedora_infrastructure/tests/__init__.py index fecb5da..476a298 100644 --- a/fedmsg_meta_fedora_infrastructure/tests/__init__.py +++ b/fedmsg_meta_fedora_infrastructure/tests/__init__.py @@ -51,364 +51,13 @@ from fedmsg_meta_fedora_infrastructure.tests.fas import * from fedmsg_meta_fedora_infrastructure.tests.hotness import * from fedmsg_meta_fedora_infrastructure.tests.mm2 import * +from fedmsg_meta_fedora_infrastructure.tests.zodbot import * from fedmsg_meta_fedora_infrastructure.tests.base import Base from fedmsg_meta_fedora_infrastructure.tests.common import add_doc -full_irc_logs = """====================================== -#fedora-meeting-1: RELENG (2015-02-09) -====================================== - - -Meeting started by dgilmore at 16:31:17 UTC. The full logs are available -at -http://meetbot.fedoraproject.org/fedora-meeting-1/2015-02-09/releng.2015-02-09-16.31.log.html -. - - - -Meeting summary ---------------- -* init process (dgilmore, 16:31:30) - -* Secondary Architectures updates (dgilmore, 16:33:42) - -* Secondary Architectures update - ppc (dgilmore, 16:33:43) - -* Secondary Architectures update - s390 (dgilmore, 16:36:35) - -* Secondary Architectures update - arm (dgilmore, 16:37:12) - -* #6016 Use fedpkg-minimal in Fedora buildroots (dgilmore, 16:39:22) - * LINK: https://fedorahosted.org/rel-eng/ticket/6016 (dgilmore, - 16:39:38) - * LINK: https://koji.fedoraproject.org/koji/buildinfo?buildID=609961 - (bochecha, 16:40:40) - -* #5959 Enable keep-alive connections for koji (primary and secondaries) - (dgilmore, 16:41:44) - * LINK: https://fedorahosted.org/rel-eng/ticket/5959 (dgilmore, - 16:41:56) - * ACTION: pbrobinson to send patch to infra list enabling keepalive - (dgilmore, 16:43:08) - -* #6023 allow Peter Robinson to restart sigul bridges (dgilmore, - 16:43:39) - * LINK: https://fedorahosted.org/rel-eng/ticket/6023 (dgilmore, - 16:43:48) - -* #6027 secondary arch old mash trees cleanup (dgilmore, 16:45:31) - * LINK: https://fedorahosted.org/rel-eng/ticket/6027 (dgilmore, - 16:45:47) - -* #6096 add individual email addressses to Fedoras GPG keys (dgilmore, - 16:52:06) - * LINK: https://fedorahosted.org/rel-eng/ticket/6096 (dgilmore, - 16:52:20) - * ACTION: dgilmore will make a choice when making the keys (dgilmore, - 16:58:51) - -* #6100 create bsd-style checksum files for CHECKSUM files (dgilmore, - 16:59:11) - * LINK: https://fedorahosted.org/rel-eng/ticket/6100 (dgilmore, - 16:59:22) - * ACTION: dgilmore to make this happen (dgilmore, 17:03:13) - -* open floor (dgilmore, 17:03:21) - -Meeting ended at 17:58:27 UTC. - - - - -Action Items ------------- -* pbrobinson to send patch to infra list enabling keepalive -* dgilmore will make a choice when making the keys -* dgilmore to make this happen - - - - -Action Items, by person ------------------------ -* dgilmore - * dgilmore will make a choice when making the keys - * dgilmore to make this happen -* pbrobinson - * pbrobinson to send patch to infra list enabling keepalive -* **UNASSIGNED** - * (none) - - - - -People Present (lines said) ---------------------------- -* dgilmore (116) -* bochecha (33) -* tyll (16) -* pbrobinson (16) -* zodbot (5) -* janeznemanic (1) -* masta (1) -* nirik (0) -* sharkcz (0) - - - - -Generated by `MeetBot`_ 0.1.4 - -.. _`MeetBot`: http://wiki.debian.org/MeetBot -""" - -class TestSupybotStartMeetingNoName(Base): - """ Trusty old `zodbot `_ publishes - messages too! Messages on this topic get published (somewhat obviously) - when a new IRC meeting is started. The user starting the meeting may - specify a meeting title, but doesn't have to. Here's an example - message with no meeting title specified: - """ - expected_title = "meetbot.meeting.start" - expected_subti = 'ralph started a meeting in #channel' - expected_icon = 'https://apps.fedoraproject.org/img/icons/meetbot.png' - expected_secondary_icon = "https://seccdn.libravatar.org/avatar/" + \ - "9c9f7784935381befc302fe3c814f9136e7a33953d0318761669b8643f4df55c?s=64&d=retro" - expected_usernames = set(['ralph']) - expected_objects = set([ - 'attendees/ralph', - 'channels/#channel', - ]) - - msg = { - "i": 16, - "msg": { - "meeting_topic": None, - "attendees": { - "zodbot": 2, - "threebean": 2 - }, - "chairs": {}, - "url": "http://logs.com/awesome", - "owner": "threebean", - "channel": "#channel" - }, - "topic": "org.fedoraproject.dev.meetbot.meeting.start", - "timestamp": 1345572862.556145 - } - - -class TestSupybotStartMeeting(Base): - """ Trusty old `zodbot `_ publishes - messages too! Messages on this topic get published (somewhat obviously) - when a new IRC meeting is started. The user starting the meeting may - specify a meeting title, but doesn't have to. Here's an example - message with a specified meeting title: - """ - expected_title = "meetbot.meeting.start" - expected_subti = 'ralph started meeting "title" in #channel' - expected_usernames = set(['ralph']) - expected_objects = set([ - 'attendees/ralph', - 'channels/#channel', - 'titles/title', - ]) - - msg = { - "i": 16, - "msg": { - "meeting_topic": "title", - "attendees": { - "zodbot": 2, - "threebean": 2 - }, - "chairs": {}, - "url": "http://logs.com/awesome", - "owner": "threebean", - "channel": "#channel" - }, - "topic": "org.fedoraproject.dev.meetbot.meeting.start", - "timestamp": 1345572862.556145 - } - - -class TestSupybotEndMeeting(Base): - """ Trusty old `zodbot `_ publishes - messages too! Messages on this topic get published when an IRC meeting - ends. Meetings may or may not have a title (which can be tricky). - Here's an example message where the title is specified: - """ - expected_title = "meetbot.meeting.complete" - expected_subti = 'dgilmore\'s meeting titled "RELENG (2015-02-09)" ' + \ - 'ended in #fedora-meeting-1' - expected_long_form = expected_subti + "\n\n" + full_irc_logs - expected_link = 'https://meetbot.fedoraproject.org/fedora-meeting-1/' + \ - '2015-02-09/releng.2015-02-09-16.31.html' - expected_usernames = set([ - 'masta', - 'nirik', - 'tyll', - 'bochecha', - 'pbrobinson', - 'sharkcz', - 'janeznemanic', - 'dgilmore', - ]) - expected_objects = set([ - 'attendees/masta', - 'attendees/nirik', - 'attendees/tyll', - 'attendees/bochecha', - 'attendees/pbrobinson', - 'attendees/sharkcz', - 'attendees/janeznemanic', - 'attendees/dgilmore', - 'channels/#fedora-meeting-1', - 'titles/RELENG (2015-02-09)', - 'topics/open floor', - ]) - - msg = { - "source_name": "datanommer", - "i": 94, - "timestamp": 1423504707.0, - "msg_id": "2015-ff043996-5aaa-471b-bc87-b8551f7fd3b6", - "topic": "org.fedoraproject.prod.meetbot.meeting.complete", - "source_version": "0.6.4", - "msg": { - "meeting_topic": "RELENG (2015-02-09)", - "attendees": { - "masta": 1, - "nirik": 0, - "tyll": 16, - "zodbot": 5, - "bochecha": 33, - "pbrobinson": 16, - "sharkcz": 0, - "janeznemanic": 1, - "dgilmore": 116 - }, - "chairs": { - "masta": True, - "nirik": True, - "tyll": True, - "bochecha": True, - "pbrobinson": True, - "dgilmore": True, - "sharkcz": True - }, - "topic": "open floor", - "url": "http://meetbot.fedoraproject.org/fedora-meeting-1/2015-02-09/releng.2015-02-09-16.31", - "owner": "dgilmore", - "channel": "#fedora-meeting-1" - } - } - - -class TestSupybotEndMeetingNoTitle(Base): - """ Trusty old `zodbot `_ publishes - messages too! Messages on this topic get published when an IRC meeting - ends. Meetings may or may not have a title (which can be tricky). - Here's an example message where the title is **not** specified: - """ - expected_title = "meetbot.meeting.complete" - expected_subti = 'ralph\'s meeting ended in #channel' - expected_link = 'https://logs.com/awesome.html' - expected_usernames = set(['ralph']) - expected_objects = set([ - 'attendees/ralph', - 'channels/#channel', - ]) - - msg = { - "i": 16, - "msg": { - "meeting_topic": None, - "attendees": { - "zodbot": 2, - "threebean": 2 - }, - "chairs": {}, - "url": "http://logs.com/awesome", - "owner": "threebean", - "channel": "#channel" - }, - "topic": "org.fedoraproject.dev.meetbot.meeting.complete", - "timestamp": 1345572862.556145 - } - - -class TestSupybotChangeTopic(Base): - """ As IRC meetings chug along, the chairperson may change the meeting; - zodbot publishes message for that! An example **with** a title specified: - """ - expected_title = "meetbot.meeting.topic.update" - expected_subti = 'The topic of ralph\'s "title" meeting changed ' +\ - 'to "Food" in #channel' - expected_usernames = set(['ralph']) - expected_objects = set([ - 'attendees/ralph', - 'channels/#channel', - 'titles/title', - 'topics/Food', - ]) - - msg = { - "i": 16, - "msg": { - "meeting_topic": "title", - "attendees": { - "zodbot": 2, - "threebean": 2 - }, - "chairs": {}, - "url": "http://logs.com/awesome", - "owner": "threebean", - "channel": "#channel", - "topic": "Food", - }, - "topic": "org.fedoraproject.dev.meetbot.meeting.topic.update", - "timestamp": 1345572862.556145 - } - - -class TestSupybotChangeTopicNoTitle(Base): - """ As IRC meetings chug along, the chairperson may change the meeting; - zodbot publishes message for that! An example **without** a title - specified: - """ - expected_title = "meetbot.meeting.topic.update" - expected_subti = 'The topic of ralph\'s meeting changed ' +\ - 'to "Food" in #channel' - expected_usernames = set(['ralph']) - expected_objects = set([ - 'attendees/ralph', - 'channels/#channel', - 'topics/Food' - ]) - - msg = { - "i": 16, - "msg": { - "meeting_topic": None, - "attendees": { - "zodbot": 2, - "threebean": 2 - }, - "chairs": {}, - "url": "http://logs.com/awesome", - "owner": "threebean", - "channel": "#channel", - "topic": "Food", - }, - "topic": "org.fedoraproject.dev.meetbot.meeting.topic.update", - "timestamp": 1345572862.556145 - } - - class TestMediaWikiEdit(Base): """ Fedora's `Wiki `_ has a fedmsg hook that publishes messages like this one when a user edits a page. diff --git a/fedmsg_meta_fedora_infrastructure/tests/zodbot.py b/fedmsg_meta_fedora_infrastructure/tests/zodbot.py new file mode 100644 index 0000000..162a709 --- /dev/null +++ b/fedmsg_meta_fedora_infrastructure/tests/zodbot.py @@ -0,0 +1,389 @@ +# This file is part of fedmsg. +# Copyright (C) 2012-2014 Red Hat, Inc. +# +# fedmsg is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# fedmsg is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with fedmsg; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +# +# Authors: Ralph Bean +# +""" Tests for fedmsg.meta """ + +import os +import unittest + +from fedmsg_meta_fedora_infrastructure.tests.base import Base + +from fedmsg_meta_fedora_infrastructure.tests.common import add_doc + + +full_irc_logs = """====================================== +#fedora-meeting-1: RELENG (2015-02-09) +====================================== + + +Meeting started by dgilmore at 16:31:17 UTC. The full logs are available +at +http://meetbot.fedoraproject.org/fedora-meeting-1/2015-02-09/releng.2015-02-09-16.31.log.html +. + + + +Meeting summary +--------------- +* init process (dgilmore, 16:31:30) + +* Secondary Architectures updates (dgilmore, 16:33:42) + +* Secondary Architectures update - ppc (dgilmore, 16:33:43) + +* Secondary Architectures update - s390 (dgilmore, 16:36:35) + +* Secondary Architectures update - arm (dgilmore, 16:37:12) + +* #6016 Use fedpkg-minimal in Fedora buildroots (dgilmore, 16:39:22) + * LINK: https://fedorahosted.org/rel-eng/ticket/6016 (dgilmore, + 16:39:38) + * LINK: https://koji.fedoraproject.org/koji/buildinfo?buildID=609961 + (bochecha, 16:40:40) + +* #5959 Enable keep-alive connections for koji (primary and secondaries) + (dgilmore, 16:41:44) + * LINK: https://fedorahosted.org/rel-eng/ticket/5959 (dgilmore, + 16:41:56) + * ACTION: pbrobinson to send patch to infra list enabling keepalive + (dgilmore, 16:43:08) + +* #6023 allow Peter Robinson to restart sigul bridges (dgilmore, + 16:43:39) + * LINK: https://fedorahosted.org/rel-eng/ticket/6023 (dgilmore, + 16:43:48) + +* #6027 secondary arch old mash trees cleanup (dgilmore, 16:45:31) + * LINK: https://fedorahosted.org/rel-eng/ticket/6027 (dgilmore, + 16:45:47) + +* #6096 add individual email addressses to Fedoras GPG keys (dgilmore, + 16:52:06) + * LINK: https://fedorahosted.org/rel-eng/ticket/6096 (dgilmore, + 16:52:20) + * ACTION: dgilmore will make a choice when making the keys (dgilmore, + 16:58:51) + +* #6100 create bsd-style checksum files for CHECKSUM files (dgilmore, + 16:59:11) + * LINK: https://fedorahosted.org/rel-eng/ticket/6100 (dgilmore, + 16:59:22) + * ACTION: dgilmore to make this happen (dgilmore, 17:03:13) + +* open floor (dgilmore, 17:03:21) + +Meeting ended at 17:58:27 UTC. + + + + +Action Items +------------ +* pbrobinson to send patch to infra list enabling keepalive +* dgilmore will make a choice when making the keys +* dgilmore to make this happen + + + + +Action Items, by person +----------------------- +* dgilmore + * dgilmore will make a choice when making the keys + * dgilmore to make this happen +* pbrobinson + * pbrobinson to send patch to infra list enabling keepalive +* **UNASSIGNED** + * (none) + + + + +People Present (lines said) +--------------------------- +* dgilmore (116) +* bochecha (33) +* tyll (16) +* pbrobinson (16) +* zodbot (5) +* janeznemanic (1) +* masta (1) +* nirik (0) +* sharkcz (0) + + + + +Generated by `MeetBot`_ 0.1.4 + +.. _`MeetBot`: http://wiki.debian.org/MeetBot +""" + +class TestSupybotStartMeetingNoName(Base): + """ Trusty old `zodbot `_ publishes + messages too! Messages on this topic get published (somewhat obviously) + when a new IRC meeting is started. The user starting the meeting may + specify a meeting title, but doesn't have to. Here's an example + message with no meeting title specified: + """ + expected_title = "meetbot.meeting.start" + expected_subti = 'ralph started a meeting in #channel' + expected_icon = 'https://apps.fedoraproject.org/img/icons/meetbot.png' + expected_secondary_icon = "https://seccdn.libravatar.org/avatar/" + \ + "9c9f7784935381befc302fe3c814f9136e7a33953d0318761669b8643f4df55c?s=64&d=retro" + expected_usernames = set(['ralph']) + expected_objects = set([ + 'attendees/ralph', + 'channels/#channel', + ]) + + msg = { + "i": 16, + "msg": { + "meeting_topic": None, + "attendees": { + "zodbot": 2, + "threebean": 2 + }, + "chairs": {}, + "url": "http://logs.com/awesome", + "owner": "threebean", + "channel": "#channel" + }, + "topic": "org.fedoraproject.dev.meetbot.meeting.start", + "timestamp": 1345572862.556145 + } + + +class TestSupybotStartMeeting(Base): + """ Trusty old `zodbot `_ publishes + messages too! Messages on this topic get published (somewhat obviously) + when a new IRC meeting is started. The user starting the meeting may + specify a meeting title, but doesn't have to. Here's an example + message with a specified meeting title: + """ + expected_title = "meetbot.meeting.start" + expected_subti = 'ralph started meeting "title" in #channel' + expected_usernames = set(['ralph']) + expected_objects = set([ + 'attendees/ralph', + 'channels/#channel', + 'titles/title', + ]) + + msg = { + "i": 16, + "msg": { + "meeting_topic": "title", + "attendees": { + "zodbot": 2, + "threebean": 2 + }, + "chairs": {}, + "url": "http://logs.com/awesome", + "owner": "threebean", + "channel": "#channel" + }, + "topic": "org.fedoraproject.dev.meetbot.meeting.start", + "timestamp": 1345572862.556145 + } + + +class TestSupybotEndMeeting(Base): + """ Trusty old `zodbot `_ publishes + messages too! Messages on this topic get published when an IRC meeting + ends. Meetings may or may not have a title (which can be tricky). + Here's an example message where the title is specified: + """ + expected_title = "meetbot.meeting.complete" + expected_subti = 'dgilmore\'s meeting titled "RELENG (2015-02-09)" ' + \ + 'ended in #fedora-meeting-1' + expected_link = 'https://meetbot.fedoraproject.org/fedora-meeting-1/' + \ + '2015-02-09/releng.2015-02-09-16.31.html' + expected_usernames = set([ + 'masta', + 'nirik', + 'tyll', + 'bochecha', + 'pbrobinson', + 'sharkcz', + 'janeznemanic', + 'dgilmore', + ]) + expected_objects = set([ + 'attendees/masta', + 'attendees/nirik', + 'attendees/tyll', + 'attendees/bochecha', + 'attendees/pbrobinson', + 'attendees/sharkcz', + 'attendees/janeznemanic', + 'attendees/dgilmore', + 'channels/#fedora-meeting-1', + 'titles/RELENG (2015-02-09)', + 'topics/open floor', + ]) + + msg = { + "source_name": "datanommer", + "i": 94, + "timestamp": 1423504707.0, + "msg_id": "2015-ff043996-5aaa-471b-bc87-b8551f7fd3b6", + "topic": "org.fedoraproject.prod.meetbot.meeting.complete", + "source_version": "0.6.4", + "msg": { + "meeting_topic": "RELENG (2015-02-09)", + "attendees": { + "masta": 1, + "nirik": 0, + "tyll": 16, + "zodbot": 5, + "bochecha": 33, + "pbrobinson": 16, + "sharkcz": 0, + "janeznemanic": 1, + "dgilmore": 116 + }, + "chairs": { + "masta": True, + "nirik": True, + "tyll": True, + "bochecha": True, + "pbrobinson": True, + "dgilmore": True, + "sharkcz": True + }, + "topic": "open floor", + "url": "http://meetbot.fedoraproject.org/fedora-meeting-1/2015-02-09/releng.2015-02-09-16.31", + "owner": "dgilmore", + "channel": "#fedora-meeting-1" + } + } + + +class TestSupybotEndMeetingNoTitle(Base): + """ Trusty old `zodbot `_ publishes + messages too! Messages on this topic get published when an IRC meeting + ends. Meetings may or may not have a title (which can be tricky). + Here's an example message where the title is **not** specified: + """ + expected_title = "meetbot.meeting.complete" + expected_subti = 'ralph\'s meeting ended in #channel' + expected_link = 'https://logs.com/awesome.html' + expected_usernames = set(['ralph']) + expected_objects = set([ + 'attendees/ralph', + 'channels/#channel', + ]) + + msg = { + "i": 16, + "msg": { + "meeting_topic": None, + "attendees": { + "zodbot": 2, + "threebean": 2 + }, + "chairs": {}, + "url": "http://logs.com/awesome", + "owner": "threebean", + "channel": "#channel" + }, + "topic": "org.fedoraproject.dev.meetbot.meeting.complete", + "timestamp": 1345572862.556145 + } + + +class TestSupybotChangeTopic(Base): + """ As IRC meetings chug along, the chairperson may change the meeting; + zodbot publishes message for that! An example **with** a title specified: + """ + expected_title = "meetbot.meeting.topic.update" + expected_subti = 'The topic of ralph\'s "title" meeting changed ' +\ + 'to "Food" in #channel' + expected_usernames = set(['ralph']) + expected_objects = set([ + 'attendees/ralph', + 'channels/#channel', + 'titles/title', + 'topics/Food', + ]) + + msg = { + "i": 16, + "msg": { + "meeting_topic": "title", + "attendees": { + "zodbot": 2, + "threebean": 2 + }, + "chairs": {}, + "url": "http://logs.com/awesome", + "owner": "threebean", + "channel": "#channel", + "topic": "Food", + }, + "topic": "org.fedoraproject.dev.meetbot.meeting.topic.update", + "timestamp": 1345572862.556145 + } + + +class TestSupybotChangeTopicNoTitle(Base): + """ As IRC meetings chug along, the chairperson may change the meeting; + zodbot publishes message for that! An example **without** a title + specified: + """ + expected_title = "meetbot.meeting.topic.update" + expected_subti = 'The topic of ralph\'s meeting changed ' +\ + 'to "Food" in #channel' + expected_usernames = set(['ralph']) + expected_objects = set([ + 'attendees/ralph', + 'channels/#channel', + 'topics/Food' + ]) + + msg = { + "i": 16, + "msg": { + "meeting_topic": None, + "attendees": { + "zodbot": 2, + "threebean": 2 + }, + "chairs": {}, + "url": "http://logs.com/awesome", + "owner": "threebean", + "channel": "#channel", + "topic": "Food", + }, + "topic": "org.fedoraproject.dev.meetbot.meeting.topic.update", + "timestamp": 1345572862.556145 + } + + +if not 'FEDMSG_META_NO_NETWORK' in os.environ: + TestSupybotEndMeeting.expected_long_form = \ + TestSupybotEndMeeting.expected_subti + "\n\n" + full_irc_logs + + +add_doc(locals()) + +if __name__ == '__main__': + unittest.main()