pep8 & pyflakes testirker. Add extra test case
authorNeil <neil@dip.sun.ac.za>
Sat, 17 Nov 2012 15:44:20 +0000 (17:44 +0200)
committerNeil <neil@dip.sun.ac.za>
Sat, 17 Nov 2012 15:44:20 +0000 (17:44 +0200)
tests/testirker.py

index 765e19d1396cdb1c31ceba8590186d5418de03e1..059f6bdfc4282aa03326a15aa969e44969de6998 100644 (file)
@@ -6,7 +6,6 @@ from unittest import TestLoader
 
 from bzrlib import (
     config,
-    tests,
     )
 from bzrlib.bzrdir import BzrDir
 from bzrlib.tests import TestCaseInTempDir
@@ -16,11 +15,14 @@ from bzrlib.plugins.bzrirker.irkerhook import IrkerSender
 def test_suite():
     return TestLoader().loadTestsFromName(__name__)
 
-sample_config=("[DEFAULT]\n"
+sample_config = ("[DEFAULT]\n"
         "irker_project=bzrirker\n"
         "irker_channels=irc://chat.example.test/commits\n")
 
-colour_config=("[DEFAULT]\n"
+no_project_config = ("[DEFAULT]\n"
+        "irker_channels=irc://chat.example.test/commits\n")
+
+colour_config = ("[DEFAULT]\n"
         "irker_project=bzrirker\n"
         "irker_colours=mIRC\n"
         "irker_channels=irc://chat.example.test/commits\n")
@@ -49,13 +51,19 @@ class TestConfigured(TestCaseInTempDir):
                 'bzrirker: Sample <john@example.test> work * 1 /  : foo bar ',
                 irker._format())
 
+    def test_no_project(self):
+        irker = self.get_irker(no_project_config)
+        self.assertEqual(
+                'No Project name set: Sample <john@example.test>'
+                ' work * 1 /  : foo bar ',
+                irker._format())
+
     def test_message_colour(self):
         irker = self.get_irker(colour_config)
         self.assertEqual(
                 '\x02bzrirker:\x0f \x0303Sample <john@example.test>\x0f'
                 ' work * \x021\x0f /  \x02\x0f: foo bar ', irker._format())
 
-
     def get_irker(self, text=sample_config):
         my_config = config.MemoryStack(text)
         self.branch = BzrDir.create_branch_convenience('.')
@@ -70,5 +78,3 @@ class TestConfigured(TestCaseInTempDir):
         # We're not calling send, so do the setup stuff here
         irker._setup_revision_and_revno()
         return irker
-        
-