Commits

Marcin Kasperski committed b0d6b5e

Test for bad style12 case in observe.

Comments (0)

Files changed (1)

tests/test_parser.py

         self.failUnlessIsInstance(info, errors.FicsCommandExecutionException)
         self.failUnlessIsInstance(info, errors.AttemptToAccessPrivateGame)
         # TODO: test exception class and info
+    def test_observe_bad_style12(self):
+        cmd, status, info = parse_fics_reply(
+            block_codes.BLKCMD_OBSERVE,
+            """You are now observing game 92.
+Game 92: Motyl (1857) Aretus (1907) rated standard 15 10
+
+<12> rnbqkbnr pppppppp -------- -------- -------- -------- PPPPPPPP RNBQKBNR W -1 1 1 1 1 0 92 Motyl Aretus 0 15 10 39 39 900 900 1 none (-:00) none 0 0 0
+""")
+        self.failIf(status)
+        self.failUnlessEqual(cmd, "observe")
+        self.failUnlessIsInstance(info, Exception)
+        self.failUnlessIsInstance(info, errors.FicsClientException)
+        self.failUnlessIsInstance(info, errors.BadStyle12Format)
+        # TODO:
+        #self.failUnlessIsInstance(info, errors.FicsCommandException)
+        #self.failUnlessIsInstance(info, errors.FicsCommandExecutionException)
+        #self.failUnlessIsInstance(info, errors.AttemptToAccessPrivateGame)
     def test_unobserve_correct(self):
         cmd, status, info = parse_fics_reply(
             block_codes.BLKCMD_UNOBSERVE,