예제 #1
0
파일: tests.py 프로젝트: mgoeminne/Lexpage
    def test_message_selection(self):
        # Create new message from another author
        other_message = Message(user=self.users[1], text='Another message')
        other_message.save()

        message = Message(user=self.author, text='s/nothing/todo')
        modified = message.substitute()

        self.assertEqual(modified.user, self.author)
        self.assertEqual(modified.text, 'Hello World!')

        # Remove the other message
        other_message.delete()
예제 #2
0
파일: tests.py 프로젝트: mgoeminne/Lexpage
 def test_valid_substitution(self):
     message = Message(user=self.author, text='s/World!/Universe!?')
     self.assertEqual(message.substitute().text, 'Hello Universe!?')
예제 #3
0
파일: tests.py 프로젝트: mgoeminne/Lexpage
 def test_no_message(self):
     message = Message(user=self.users[1], text='s/nothing/todo')
     self.assertIsNone(message.substitute())
예제 #4
0
파일: tests.py 프로젝트: mgoeminne/Lexpage
 def test_no_match(self):
     message = Message(user=self.author, text='s/bye/nothing')
     self.assertEqual(message.substitute().text, 'Hello World!')
예제 #5
0
파일: tests.py 프로젝트: mgoeminne/Lexpage
 def test_empty_match(self):
     message = Message(user=self.author, text='s//o')
     self.assertIsNone(message.substitute())
예제 #6
0
파일: tests.py 프로젝트: mgoeminne/Lexpage
 def test_empty_pattern(self):
     message = Message(user=self.author, text='s/o/')
     self.assertEqual(message.substitute().text, 'Hell World!')
예제 #7
0
파일: tests.py 프로젝트: mgoeminne/Lexpage
 def test_valid_multiple_substitutions(self):
     message = Message(user=self.author, text='s/o/p')
     self.assertEqual(message.substitute().text, 'Hellp World!')