示例#1
0
 def testDelCommand_existingIsMalformed(self):
     # we should be told we cannot to add to a snippet that is malformed!
     r = slacklib.command_del('*****@*****.**', ['0'])
     self.assertIn("Your snippets are not in a format I understand", r)
     # ...and the existing snippets should not have been touched
     t = self._most_recent_snippet('*****@*****.**')
     self.assertIn("I had fun", t.text)
     self.assertEquals(False, t.is_markdown)
示例#2
0
 def testDelCommand_existingIsMalformed(self):
     # we should be told we cannot to add to a snippet that is malformed!
     r = slacklib.command_del('*****@*****.**', ['0'])
     self.assertIn("Your snippets are not in a format I understand", r)
     # ...and the existing snippets should not have been touched
     t = self._most_recent_snippet('*****@*****.**')
     self.assertIn("I had fun", t.text)
     self.assertEquals(False, t.is_markdown)
示例#3
0
 def testDelCommand_normalCase(self):
     r = slacklib.command_del('*****@*****.**', ['1'])
     t = self._most_recent_snippet('*****@*****.**')
     self.assertIn(
         "Removed *sniffed some things* from your weekly snippets", r)
     expected = textwrap.dedent("""
         - went for a walk
         - hoping to sniff more things! #yolo
     """).strip()
     self.assertEqual(expected, t.text)
     self.assertEquals(True, t.is_markdown)
示例#4
0
 def testDelCommand_normalCase(self):
     r = slacklib.command_del('*****@*****.**', ['1'])
     t = self._most_recent_snippet('*****@*****.**')
     self.assertIn(
         "Removed *sniffed some things* from your weekly snippets", r)
     expected = textwrap.dedent("""
         - went for a walk
         - hoping to sniff more things! #yolo
     """).strip()
     self.assertEqual(expected, t.text)
     self.assertEquals(True, t.is_markdown)
示例#5
0
 def testDelCommand_indexNaN(self):
     r = slacklib.command_del('*****@*****.**', ['one'])
     self.assertIn("*what* do you want me to delete exactly?", r)
示例#6
0
 def testDelCommand_nonexistentIndex(self):
     r1 = slacklib.command_del('*****@*****.**', ['0'])
     r2 = slacklib.command_del('*****@*****.**', ['4'])
     expected = "You don't have anything at that index"
     self.assertIn(expected, r1)
     self.assertIn(expected, r2)
示例#7
0
 def testDelCommand_noAccount(self):
     # dont crash horribly if user doesnt exist
     r = slacklib.command_del('*****@*****.**', ['1'])
     self.assertIn("You don't appear to have a snippets account", r)
示例#8
0
 def testDelCommand_noArgs(self):
     # we need to handle when they try to add nothing!
     r = slacklib.command_del('*****@*****.**', [])
     self.assertIn("*what* do you want me to delete exactly?", r)
示例#9
0
 def testDelCommand_indexNaN(self):
     r = slacklib.command_del('*****@*****.**', ['one'])
     self.assertIn("*what* do you want me to delete exactly?", r)
示例#10
0
 def testDelCommand_nonexistentIndex(self):
     r1 = slacklib.command_del('*****@*****.**', ['0'])
     r2 = slacklib.command_del('*****@*****.**', ['4'])
     expected = "You don't have anything at that index"
     self.assertIn(expected, r1)
     self.assertIn(expected, r2)
示例#11
0
 def testDelCommand_noAccount(self):
     # dont crash horribly if user doesnt exist
     r = slacklib.command_del('*****@*****.**', ['1'])
     self.assertIn("You don't appear to have a snippets account", r)
示例#12
0
 def testDelCommand_noArgs(self):
     # we need to handle when they try to add nothing!
     r = slacklib.command_del('*****@*****.**', [])
     self.assertIn("*what* do you want me to delete exactly?", r)