Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 5
0
 def testDelCommand_indexNaN(self):
     r = slacklib.command_del('*****@*****.**', ['one'])
     self.assertIn("*what* do you want me to delete exactly?", r)
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 9
0
 def testDelCommand_indexNaN(self):
     r = slacklib.command_del('*****@*****.**', ['one'])
     self.assertIn("*what* do you want me to delete exactly?", r)
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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)