Exemplo n.º 1
0
    def test_main_execute_error(self, m_exit, m_conf_log, m_plugin, m_sys, m_os):
        # Mock
        m_os.environ = self.env
        m_sys.stdin.readlines.return_value = json.dumps(self.network_config)
        m_plugin.reset_mock()
        m_plugin(self.network_config, self.env).execute.side_effect = Exception

        # Call
        main()

        # Assert
        m_exit.assert_called_once_with(ERR_CODE_UNHANDLED, message=ANY, details=ANY)
Exemplo n.º 2
0
    def test_main(self, m_conf_log, m_plugin, m_sys, m_os):
        # Mock
        m_os.environ = self.env
        m_sys.stdin.readlines.return_value = json.dumps(self.network_config)
        m_plugin.reset_mock()

        # Call
        main()

        # Assert
        m_plugin.assert_called_once_with(self.network_config, self.env)
        m_plugin(self.env, self.network_config).execute.assert_called_once_with()
Exemplo n.º 3
0
    def test_main(self, m_conf_log, m_plugin, m_sys, m_os):
        # Mock
        m_os.environ = self.env
        m_sys.stdin.readlines.return_value = json.dumps(self.network_config)
        m_plugin.reset_mock()

        # Call
        main()

        # Assert
        m_plugin.assert_called_once_with(self.network_config, self.env)
        m_plugin(self.env,
                 self.network_config).execute.assert_called_once_with()
Exemplo n.º 4
0
    def test_main_execute_error(self, m_exit, m_conf_log, m_plugin, m_sys,
                                m_os):
        # Mock
        m_os.environ = self.env
        m_sys.stdin.readlines.return_value = json.dumps(self.network_config)
        m_plugin.reset_mock()
        m_plugin(self.network_config, self.env).execute.side_effect = Exception

        # Call
        main()

        # Assert
        m_exit.assert_called_once_with(ERR_CODE_UNHANDLED,
                                       message=ANY,
                                       details=ANY)