Commits

Guido Draheim  committed 0766502

test 2entries

  • Participants
  • Parent commits 22d4bb1

Comments (0)

Files changed (1)

File src/tests/computer_test.py

 import unittest
 
+import logging
+_logg = logging.getLogger("TESTS")
+if not _logg.handlers:
+    _logg.addHandler(logging.StreamHandler())
+    _logg.setLevel(logging.INFO)
+
 from dvbcronrecording.computer import DvbCronRecordingPlanComputer
-
 from trac.core import ComponentManager
 
 # fix this...
 
 class DvbComputerTests(unittest.TestCase):
     env = None
+    logg = _logg
     def setUp(self):
         if self.env is None:
             self.env = ComponentManager() 
     def test_03_entries(self):
         a = Entry("ard","ard1","22:30","23:30","0", "6", "", "ok")
         req = Request(Locale("de"))
-        print self.computer.plan4(req, [a])
+        res = self.computer.plan4(req, [a])
+        self.logg.info("\n%s", res)
+        E = u"{[{  [22:30-23:30]6@0 None([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]) 'ard1' }]}"
+        self.assertEqual(unicode(res), E)
     def test_04_entries(self):
         a = Entry("ard","ard1","22:30","23:30","0", "", "22.04.", "ok")
         req = Request(Locale("de"))
-        print self.computer.plan4(req, [a])
-
+        res = self.computer.plan4(req, [a])
+        self.logg.info("\n%s", res)
+        E = u"{[{  [22:30-23:30]6@0 22([4]) 'ard1' }]}"
+        self.assertEqual(unicode(res), E)
+    def test_10_2entries(self):
+        a = Entry("ard","ard1","22:30","23:30","0", "", "22.04.", "ok")
+        b = Entry("ard","ard1","23:30","00:30","0", "", "22.04.", "ok")
+        req = Request(Locale("de"))
+        res = self.computer.plan4(req, [a, b])
+        self.logg.info("\n%s", res)
+        E = u"{[{  [22:30-23:30]6@0 22([4]) 'ard1' },{  [23:30-00:30]6@0 22([4]) 'ard1' }]}"
+        self.assertEqual(unicode(res), E)
+    def test_11_2entries(self):
+        a = Entry("ard","ard1","22:30","23:30","0", "", "22.04.", "ok")
+        b = Entry("ard","ard1","23:33","00:33","0", "", "22.04.", "ok")
+        req = Request(Locale("de"))
+        res = self.computer.plan4(req, [a, b])
+        self.logg.info("\n%s", res)
+        E = u"{[{  [22:30-23:30]6@0 22([4]) 'ard1' }],[{  [23:33-00:33]6@0 22([4]) 'ard1' }]}"
+        self.assertEqual(unicode(res), E)
 
 if __name__ == "__main__":
     unittest.main()