Fix testsuite
authorNeil <neil@dip.sun.ac.za>
Sun, 11 Nov 2012 22:45:13 +0000 (00:45 +0200)
committerNeil <neil@dip.sun.ac.za>
Sun, 11 Nov 2012 22:45:13 +0000 (00:45 +0200)
tests/testirker.py

index fb7c49d73b99424daace12e4c58ce5e52662f9aa..765e19d1396cdb1c31ceba8590186d5418de03e1 100644 (file)
@@ -17,12 +17,10 @@ def test_suite():
     return TestLoader().loadTestsFromName(__name__)
 
 sample_config=("[DEFAULT]\n"
-        "irker_url=bzr://test.example.test/bzrirker\n"
         "irker_project=bzrirker\n"
         "irker_channels=irc://chat.example.test/commits\n")
 
 colour_config=("[DEFAULT]\n"
-        "irker_url=bzr://test.example.test/bzrirker\n"
         "irker_project=bzrirker\n"
         "irker_colours=mIRC\n"
         "irker_channels=irc://chat.example.test/commits\n")
@@ -30,18 +28,15 @@ colour_config=("[DEFAULT]\n"
 
 class TestConfigured(TestCaseInTempDir):
 
-    def test_url(self):
-        irker = self.get_irker()
-        self.assertEqual('bzr://test.example.test/bzrirker', irker.url())
-
-    def test_colours(self):
+    def test_no_colours(self):
         irker = self.get_irker()
         self.assertEqual({
             'bold': '', 'green': '', 'blue': '', 'red': '',
             'yellow': '', 'brown': '', 'magenta': '', 'cyan': '',
             'reset': ''}, irker.colours())
 
-        irker = self.get_irker(color_config)
+    def test_colours(self):
+        irker = self.get_irker(colour_config)
         self.assertEqual({
             'bold': '\x02', 'green': '\x0303', 'blue': '\x0302',
             'red': '\x0305', 'yellow': '\x0307', 'brown': '\x0305',
@@ -51,17 +46,21 @@ class TestConfigured(TestCaseInTempDir):
     def test_message(self):
         irker = self.get_irker()
         self.assertEqual(
-                '', irker._format())
-        irker = self.get_irker(color_config)
+                'bzrirker: Sample <john@example.test> work * 1 /  : foo bar ',
+                irker._format())
+
+    def test_message_colour(self):
+        irker = self.get_irker(colour_config)
         self.assertEqual(
-                '', irker._format())
+                '\x02bzrirker:\x0f \x0303Sample <john@example.test>\x0f'
+                ' work * \x021\x0f /  \x02\x0f: foo bar ', irker._format())
 
 
-    def get_irker(sef, text=sample_config):
+    def get_irker(self, text=sample_config):
         my_config = config.MemoryStack(text)
         self.branch = BzrDir.create_branch_convenience('.')
         tree = self.branch.bzrdir.open_workingtree()
-        tree.commit('foo bar baz\nfuzzy\nwuzzy', rev_id='A',
+        tree.commit('foo bar\nfuzzy\nwuzzy', rev_id='A',
                 allow_pointless=True,
                 timestamp=1,
                 timezone=0,