Example #1
0
 def setUp(self):
     self.screen = MockScreen()
     self.time = MockIO()
     self.char_reader = MockIO()
     self.screen_printer = MockIO()
     self.console = Console(self.time, self.char_reader,
                            self.screen_printer, self.screen)
Example #2
0
class Test(unittest.TestCase):
    def setUp(self):
        self.screen = MockScreen()
        self.time = MockIO()
        self.char_reader = MockIO()
        self.screen_printer = MockIO()
        self.console = Console(self.time, self.char_reader,  self.screen_printer, self.screen)
        
    def test_mainloop(self):
        self.char_reader.put_char(list("asdfr")+[None]*10+list("ffasq"))
        self.console.main_loop()
        self.assertEquals(11,  self.time.totalsleep)
        self.assertEquals(3,  self.screen.printcalls)
Example #3
0
class Test(unittest.TestCase):
    def setUp(self):
        self.screen = MockScreen()
        self.time = MockIO()
        self.char_reader = MockIO()
        self.screen_printer = MockIO()
        self.console = Console(self.time, self.char_reader,
                               self.screen_printer, self.screen)

    def test_mainloop(self):
        self.char_reader.put_char(list("asdfr") + [None] * 10 + list("ffasq"))
        self.console.main_loop()
        self.assertEquals(11, self.time.totalsleep)
        self.assertEquals(3, self.screen.printcalls)
Example #4
0
    def setUp(self):
        self.mock_telnet = MockTelnet()
        self.mock_os = MockOs()
        self.mock_file = MockFile()
        self.mock_file.char = 'q'
        self.mock_time = MockTime()
        self.mock_sys = MockSys(self.mock_file)
        self.mock_termios = MockTermios()
        self.mock_fcntl = MockFcntl()

        self.beanstalkd = Beanstalkd(self.mock_telnet, '', '')
        self.stats = BeanstalkdStats(self.beanstalkd)
        self.char_reader = CharReader(self.mock_os, self.mock_sys,
                                      self.mock_termios, self.mock_fcntl)
        self.screen_printer = ScreenPrinter(self.mock_os, self.mock_sys)
        self.console = Console(Clock(self.mock_time), self.char_reader,
                               self.screen_printer, self.stats)
Example #5
0
class Test(unittest.TestCase):
    def setUp(self):
        self.mock_telnet = MockTelnet()
        self.mock_os = MockOs()
        self.mock_file = MockFile()
        self.mock_file.char = 'q'
        self.mock_time = MockTime()
        self.mock_sys = MockSys(self.mock_file)
        self.mock_termios = MockTermios()
        self.mock_fcntl = MockFcntl()

        self.beanstalkd = Beanstalkd(self.mock_telnet, '', '')
        self.stats = BeanstalkdStats(self.beanstalkd)
        self.char_reader = CharReader(self.mock_os, self.mock_sys,
                                      self.mock_termios, self.mock_fcntl)
        self.screen_printer = ScreenPrinter(self.mock_os, self.mock_sys)
        self.console = Console(Clock(self.mock_time), self.char_reader,
                               self.screen_printer, self.stats)

    def test_integration(self):
        self.beanstalkd.connect()
        self.console.main_loop()
Example #6
0
 def setUp(self):
     self.screen = MockScreen()
     self.time = MockIO()
     self.char_reader = MockIO()
     self.screen_printer = MockIO()
     self.console = Console(self.time, self.char_reader,  self.screen_printer, self.screen)