Exemplo n.º 1
0
 def test_shutdown(self, mock_method):
     """
     Position
     dsgrid shutdown
     """
     mock_method.return_value = True
     shell.main(["shutdown"])
Exemplo n.º 2
0
 def test_shutdown(self, mock_method):
     """
     Position
     dsgrid shutdown
     """
     mock_method.return_value = True
     shell.main(['shutdown'])
Exemplo n.º 3
0
 def test_start(self, mock_start, mock_is_running):
     """
     Positive
     dsgrid start
     """
     mock_is_running.return_value = False
     mock_start.return_value = True
     shell.main(["start"])
Exemplo n.º 4
0
 def test_start(self, mock_start, mock_is_running):
     """
     Positive
     dsgrid start
     """
     mock_is_running.return_value = False
     mock_start.return_value = True
     shell.main(['start'])
Exemplo n.º 5
0
    def test_start_while_running(self, mock_start, mock_is_running):
        """
        Negative: Grid is running
        dsgrid start
        """
        mock_is_running.return_value = True
        mock_start.return_value = True
        with patch('sys.stdout', devnull):
            with self.assertRaises(SystemExit) as cm:
                shell.main(['start'])

        self.assertEqual(cm.exception.code, 1)
Exemplo n.º 6
0
    def test_start_while_running(self, mock_start, mock_is_running):
        """
        Negative: Grid is running
        dsgrid start
        """
        mock_is_running.return_value = True
        mock_start.return_value = True
        with patch("sys.stdout", devnull):
            with self.assertRaises(SystemExit) as cm:
                shell.main(["start"])

        self.assertEqual(cm.exception.code, 1)
Exemplo n.º 7
0
    def test_start_but_container_fails(self, mock_start, mock_is_running):
        """
        Positive
        dsgrid start
        """
        mock_is_running.return_value = False
        mock_start.return_value = False
        with patch("sys.stdout", devnull):
            with self.assertRaises(SystemExit) as cm:
                shell.main(["start"])

        self.assertEqual(cm.exception.code, 1)
Exemplo n.º 8
0
    def test_start_but_container_fails(self, mock_start, mock_is_running):
        """
        Positive
        dsgrid start
        """
        mock_is_running.return_value = False
        mock_start.return_value = False
        with patch('sys.stdout', devnull):
            with self.assertRaises(SystemExit) as cm:
                shell.main(['start'])

        self.assertEqual(cm.exception.code, 1)
Exemplo n.º 9
0
 def test_nodes_unknown_action(self):
     with self.assertRaises(SystemExit) as cm:
         shell.main(['nodes', 'juggle'])
     self.assertEqual(cm.exception.code, 1)
Exemplo n.º 10
0
    def test_nodes_missing_action(self):
        with patch('sys.stdout', devnull):
            with self.assertRaises(SystemExit) as cm:
                shell.main(['nodes'])

        self.assertEqual(cm.exception.code, 1)
Exemplo n.º 11
0
 def test_restart_nodes_specific_browser(self):
     shell.main(['nodes', 'restart', 'firefox'])
Exemplo n.º 12
0
 def test_add_node_but_container_fails(self, mock_method):
     mock_method.return_value = False
     with patch('sys.stdout', devnull):
         with self.assertRaises(SystemExit) as cm:
             shell.main(['nodes', 'add', 'firefox'])
     self.assertEqual(cm.exception.code, 1)
Exemplo n.º 13
0
 def test_restart_nodes(self):
     shell.main(['nodes', 'restart'])
Exemplo n.º 14
0
    def test_unknown_option(self):
        with self.assertRaises(SystemExit) as cm:
            shell.main(["shake"])

        self.assertEqual(cm.exception.code, 1)
Exemplo n.º 15
0
 def test_status_not_running(self, mock_method):
     mock_method.return_value = False
     # with patch('sys.stdout', devnull):
     with self.assertRaises(SystemExit) as cm:
         shell.main(["status"])
     self.assertEqual(cm.exception.code, 1)
Exemplo n.º 16
0
 def test_add_valid_browser(self, mock_method):
     mock_method.return_value = True
     shell.main(["nodes", "add", "firefox"])
Exemplo n.º 17
0
 def test_shutdown_while_not_running(self, mock_method):
     mock_method.return_value = False
     with patch("sys.stdout", devnull):
         with self.assertRaises(SystemExit) as cm:
             shell.main(["shutdown"])
     self.assertEqual(cm.exception.code, 1)
Exemplo n.º 18
0
 def test_add_valid_browser(self, mock_method):
     mock_method.return_value = True
     shell.main(['nodes', 'add', 'firefox'])
Exemplo n.º 19
0
 def test_add_browser_with_multiple(self, mock_method):
     mock_method.return_value = True
     shell.main(['nodes', 'add', 'firefox', '2'])
Exemplo n.º 20
0
 def test_status_running(self, mock_method):
     mock_method.return_value = True
     shell.main(['status'])
Exemplo n.º 21
0
 def test_stop_nodes(self):
     shell.main(['nodes', 'stop'])
Exemplo n.º 22
0
 def test_stop_nodes_specific_browser(self):
     shell.main(['nodes', 'stop', 'firefox'])
Exemplo n.º 23
0
 def test_status_running(self, mock_method):
     mock_method.return_value = True
     shell.main(["status"])
Exemplo n.º 24
0
 def test_add_browser_with_multiple(self, mock_method):
     mock_method.return_value = True
     shell.main(['nodes', 'add', 'firefox', '2'])
Exemplo n.º 25
0
 def test_add_browser_with_multiple(self, mock_method):
     mock_method.return_value = True
     shell.main(["nodes", "add", "firefox", "2"])
Exemplo n.º 26
0
    def test_add_node_invalid_browser(self):
        with patch('sys.stdout', devnull):
            with self.assertRaises(SystemExit) as cm:
                shell.main(['nodes', 'add', 'netscape'])

        self.assertEqual(cm.exception.code, 1)
Exemplo n.º 27
0
    def test_add_node_invalid_browser(self):
        with patch("sys.stdout", devnull):
            with self.assertRaises(SystemExit) as cm:
                shell.main(["nodes", "add", "netscape"])

        self.assertEqual(cm.exception.code, 1)
Exemplo n.º 28
0
 def test_add_node_but_container_fails(self, mock_method):
     mock_method.return_value = False
     with patch("sys.stdout", devnull):
         with self.assertRaises(SystemExit) as cm:
             shell.main(["nodes", "add", "firefox"])
     self.assertEqual(cm.exception.code, 1)
Exemplo n.º 29
0
 def test_add_valid_browser(self, mock_method):
     mock_method.return_value = True
     shell.main(['nodes', 'add', 'firefox'])
Exemplo n.º 30
0
 def test_restart_nodes(self):
     shell.main(["nodes", "restart"])
Exemplo n.º 31
0
    def test_add_node_invalid_browser(self):
        with patch('sys.stdout', devnull):
            with self.assertRaises(SystemExit) as cm:
                shell.main(['nodes', 'add', 'netscape'])

        self.assertEqual(cm.exception.code, 1)
Exemplo n.º 32
0
 def test_restart_nodes_specific_browser(self):
     shell.main(["nodes", "restart", "firefox"])
Exemplo n.º 33
0
 def test_restart_nodes(self):
     shell.main(['nodes', 'restart'])
Exemplo n.º 34
0
 def test_stop_nodes(self):
     shell.main(["nodes", "stop"])
Exemplo n.º 35
0
 def test_stop_nodes(self):
     shell.main(['nodes', 'stop'])
Exemplo n.º 36
0
    def test_nodes_missing_action(self):
        with patch("sys.stdout", devnull):
            with self.assertRaises(SystemExit) as cm:
                shell.main(["nodes"])

        self.assertEqual(cm.exception.code, 1)
Exemplo n.º 37
0
 def test_stop_nodes_specific_browser(self):
     shell.main(['nodes', 'stop', 'firefox'])
Exemplo n.º 38
0
 def test_stop_nodes_specific_browser(self):
     shell.main(["nodes", "stop", "firefox"])
Exemplo n.º 39
0
 def test_status_not_running(self, mock_method):
     mock_method.return_value = False
     #with patch('sys.stdout', devnull):
     with self.assertRaises(SystemExit) as cm:
         shell.main(['status'])
     self.assertEqual(cm.exception.code, 1)
Exemplo n.º 40
0
 def test_nodes_unknown_action(self):
     with self.assertRaises(SystemExit) as cm:
         shell.main(["nodes", "juggle"])
     self.assertEqual(cm.exception.code, 1)
Exemplo n.º 41
0
    def test_unknown_option(self):
        with self.assertRaises(SystemExit) as cm:
            shell.main(['shake'])

        self.assertEqual(cm.exception.code, 1)
Exemplo n.º 42
0
 def test_restart_nodes_specific_browser(self):
     shell.main(['nodes', 'restart', 'firefox'])