Ejemplo n.º 1
0
class SMMTestView(unittest.TestCase):

    def setUp(self):
        self.view = ColorfulAsciiDisplay(UncoloredPrinter)

    @patch('sys.stdout', new_callable=StringIO)
    def test_view_header(self, mock_stdout):
        self.view.display_db_stats_header(10, 20)
        assert mock_stdout.getvalue(
        ) == 'Total Commands: 10 Total Groups: 20\n'

    @patch('sys.stdout', new_callable=StringIO)
    def test_view_display_all_groups_header_empty(self, mock_stdout):
        self.view.display_all_groups_header([])
        assert mock_stdout.getvalue() == 'Groups: \n'

    @patch('sys.stdout', new_callable=StringIO)
    def test_view_display_all_groups_header(self, mock_stdout):
        self.view.display_all_groups_header(['G1', 'G2'])
        assert mock_stdout.getvalue() == 'Groups: G1, G2\n'

    @patch('sys.stdout', new_callable=StringIO)
    def test_view_display_footer(self, mock_stdout):
        self.view.display_footer(0)
        assert mock_stdout.getvalue() == 'Result%: 0.00\n'
Ejemplo n.º 2
0
 def __init__(self,
              smm_backend=SMMemory(),
              display=ColorfulAsciiDisplay(ColorTerminalPrinter),
              wait_for_user_input=True):
     self.smm_display = display
     self.smm_backend = smm_backend
     self.wait_for_user_input = wait_for_user_input
Ejemplo n.º 3
0
class SMMTestView(unittest.TestCase):
    def setUp(self):
        self.view = ColorfulAsciiDisplay(UncoloredPrinter)

    @patch('sys.stdout', new_callable=StringIO)
    def test_view_header(self, mock_stdout):
        self.view.display_db_stats_header(10, 20)
        assert mock_stdout.getvalue(
        ) == 'Total Commands: 10 Total Groups: 20\n'

    @patch('sys.stdout', new_callable=StringIO)
    def test_view_display_all_groups_header_empty(self, mock_stdout):
        self.view.display_all_groups_header([])
        assert mock_stdout.getvalue() == 'Groups: \n'

    @patch('sys.stdout', new_callable=StringIO)
    def test_view_display_all_groups_header(self, mock_stdout):
        self.view.display_all_groups_header(['G1', 'G2'])
        assert mock_stdout.getvalue() == 'Groups: G1, G2\n'

    @patch('sys.stdout', new_callable=StringIO)
    def test_view_display_footer(self, mock_stdout):
        self.view.display_footer(0)
        assert mock_stdout.getvalue() == 'Result%: 0.00\n'
Ejemplo n.º 4
0
 def setUp(self):
     self.view = ColorfulAsciiDisplay(UncoloredPrinter)
Ejemplo n.º 5
0
 def setUp(self):
     self.view = ColorfulAsciiDisplay(UncoloredPrinter)