@@ -57,6 +57,8 @@ def test_statics(self):
5757 ],
5858 )
5959 def test_execute (self , args ):
60+ if isinstance (args , str ):
61+ args = (args ,)
6062 msg = cmd .execute (
6163 BotCommand (
6264 backend = "slack" ,
@@ -71,78 +73,79 @@ def test_execute(self, args):
7173 assert msg is not None
7274 assert msg .backend == "slack"
7375 assert msg .channel == "test_channel"
76+ msg_text = msg .msg .replace ("<@" , "@" ).replace (">" , "" )
7477
7578 if args [0 ] == "icelandic" :
76- assert msg . msg . startswith ("< @123> consoles < @456> with an Icelandic folk saying:" )
79+ assert msg_text . startswith ("@123 consoles @456 with an Icelandic folk saying:" )
7780 elif args [0 ] == "german" :
78- assert msg . msg . startswith ("< @123> teaches < @456> some German:" )
81+ assert msg_text . startswith ("@123 teaches @456 some German:" )
7982 elif args [0 ] == "cocktail" :
80- assert msg . msg . startswith ("< @123> calls < @456> over to the" )
83+ assert msg_text . startswith ("@123 calls @456 over to the" )
8184 elif args [0 ] == "beer" :
82- assert msg . msg . startswith ("< @123> calls < @456> over to the" )
85+ assert msg_text . startswith ("@123 calls @456 over to the" )
8386 elif args [0 ] == "dune" :
84- assert msg . msg . startswith ("< @123> scrapes wisdom for < @456> off the sands of Arrakis:" )
87+ assert msg_text . startswith ("@123 scrapes wisdom for @456 off the sands of Arrakis:" )
8588 elif args [0 ] == "bush" :
86- assert msg . msg . startswith ("< @123> impresses < @456> with a quote from George W. Bush:" )
89+ assert msg_text . startswith ("@123 impresses @456 with a quote from George W. Bush:" )
8790 elif args [0 ] == "shakespeare" :
88- assert msg . msg . startswith ("< @123> hurls a Shakespearean insult at < @456> :" )
91+ assert msg_text . startswith ("@123 hurls a Shakespearean insult at @456:" )
8992 elif args [0 ] == "yogi" :
90- assert msg . msg . startswith ("< @123> shares some Yogi Berra wisdom with < @456> :" )
93+ assert msg_text . startswith ("@123 shares some Yogi Berra wisdom with @456:" )
9194 elif args [0 ] == "tolkien" :
92- assert msg . msg . startswith ("< @123> offers < @456> wisdom from Middle-earth:" )
95+ assert msg_text . startswith ("@123 offers @456 wisdom from Middle-earth:" )
9396 elif args [0 ] == "fortune" :
94- assert msg . msg . startswith ("< @123> cracks open a fortune cookie for < @456> :" )
97+ assert msg_text . startswith ("@123 cracks open a fortune cookie for @456:" )
9598 elif args [0 ] == "pratchett" :
96- assert msg . msg . startswith ("< @123> enlightens < @456> with Pratchett:" )
99+ assert msg_text . startswith ("@123 enlightens @456 with Pratchett:" )
97100 elif args [0 ] == "wilde" :
98- assert msg . msg . startswith ("< @123> graces < @456> with an Oscar Wilde quip:" )
101+ assert msg_text . startswith ("@123 graces @456 with an Oscar Wilde quip:" )
99102 elif args [0 ] == "wine" :
100- assert msg . msg . startswith ("< @123> calls < @456> over to the" )
103+ assert msg_text . startswith ("@123 calls @456 over to the" )
101104 elif args [0 ] == "nietzsche" :
102- assert msg . msg . startswith ("< @123> darkly enlightens < @456> with Nietzsche:" )
105+ assert msg_text . startswith ("@123 darkly enlightens @456 with Nietzsche:" )
103106 elif args [0 ] == "twain" :
104- assert msg . msg . startswith ("< @123> shares a Mark Twain quip with < @456> :" )
107+ assert msg_text . startswith ("@123 shares a Mark Twain quip with @456:" )
105108 elif args [0 ] == "zen" :
106- assert msg . msg . startswith ("< @123> offers < @456> a moment of zen:" )
109+ assert msg_text . startswith ("@123 offers @456 a moment of zen:" )
107110 elif args [0 ] == "stoic" :
108- assert msg . msg . startswith ("< @123> offers < @456> some Stoic counsel:" )
111+ assert msg_text . startswith ("@123 offers @456 some Stoic counsel:" )
109112 elif args [0 ] == "churchill" :
110- assert msg . msg . startswith ("< @123> channels Churchill for < @456> :" )
113+ assert msg_text . startswith ("@123 channels Churchill for @456:" )
111114 elif args [0 ] == "confucius" :
112- assert msg . msg . startswith ("< @123> shares ancient wisdom with < @456> :" )
115+ assert msg_text . startswith ("@123 shares ancient wisdom with @456:" )
113116 elif args [0 ] == "starwars" :
114- assert msg . msg . startswith ("< @123> reaches for the Force on behalf of < @456> :" )
117+ assert msg_text . startswith ("@123 reaches for the Force on behalf of @456:" )
115118 elif args [0 ] == "hitch" :
116- assert msg . msg . startswith ("< @123> consults the Guide for < @456> :" )
119+ assert msg_text . startswith ("@123 consults the Guide for @456:" )
117120 elif args [0 ] == "hemingway" :
118- assert msg . msg . startswith ("< @123> pours a drink and quotes Hemingway for < @456> :" )
121+ assert msg_text . startswith ("@123 pours a drink and quotes Hemingway for @456:" )
119122 elif args [0 ] == "dad" :
120- assert msg . msg . startswith ("< @123> subjects < @456> to a dad joke:" )
123+ assert msg_text . startswith ("@123 subjects @456 to a dad joke:" )
121124 elif args [0 ] == "chuck" :
122- assert msg . msg . startswith ("< @123> informs < @456> of a Chuck Norris fact:" )
125+ assert msg_text . startswith ("@123 informs @456 of a Chuck Norris fact:" )
123126 elif args [0 ] == "soviet" :
124- assert msg . msg . startswith ("< @123> reminds < @456> :" )
127+ assert msg_text . startswith ("@123 reminds @456:" )
125128 elif args [0 ] == "conspiracy" :
126- assert msg . msg . startswith ("< @123> whispers to < @456> :" )
129+ assert msg_text . startswith ("@123 whispers to @456:" )
127130 elif args [0 ] == "magic8" :
128- assert msg . msg . startswith ("< @123> shakes the Magic 8-Ball for < @456> :" )
131+ assert msg_text . startswith ("@123 shakes the Magic 8-Ball for @456:" )
129132 elif args [0 ] == "compliment" :
130- assert msg . msg . startswith ("< @123> lavishes praise on < @456> :" )
133+ assert msg_text . startswith ("@123 lavishes praise on @456:" )
131134 elif args [0 ] == "latin" :
132- assert msg . msg . startswith ("< @123> schools < @456> in Latin:" )
135+ assert msg_text . startswith ("@123 schools @456 in Latin:" )
133136 elif args [0 ] == "pirate" :
134- assert msg . msg . startswith ("< @123> makes < @456> walk the plank:" )
137+ assert msg_text . startswith ("@123 makes @456 walk the plank:" )
135138 elif args [0 ] == "corporate" :
136- assert msg . msg . startswith ("< @123> synergizes with < @456> :" )
139+ assert msg_text . startswith ("@123 synergizes with @456:" )
137140 elif args [0 ] == "motivational" :
138- assert msg . msg . startswith ("< @123> puts a poster on < @456> " )
141+ assert msg_text . startswith ("@123 puts a poster on @456" )
139142 elif args [0 ] == "haiku" :
140- assert msg . msg . startswith ("< @123> composes a haiku for < @456> :" )
143+ assert msg_text . startswith ("@123 composes a haiku for @456:" )
141144 elif args [0 ] == "programming" :
142- assert msg . msg . startswith ("< @123> shares a programming joke with < @456> :" )
145+ assert msg_text . startswith ("@123 shares a programming joke with @456:" )
143146 elif args [0 ] == "whiskey" :
144- assert msg . msg . startswith ("< @123> calls < @456> over to the" )
147+ assert msg_text . startswith ("@123 calls @456 over to the" )
145148 elif args [0 ] == "highfive" :
146- assert msg . msg . startswith ("< @123> gives < @456> a magnificent" )
149+ assert msg_text . startswith ("@123 gives @456 a magnificent" )
147150 else :
148151 assert False
0 commit comments