Example #1
0
 def test_showing_details(self, CLIFeedback, exit, _info, _error):
     CLI(self.core).run()
     fb = CLIFeedback.return_value
     self.core.show_app.assert_called_once_with('app', fb)
     fb.report_details.assert_called_once()
     _error.assert_not_called()
     exit.assert_not_called()
Example #2
0
 def test_adding_apps2(self, exit, _info, _error):
     self.core.add.side_effect = ExecutableAssignedError('app2', 'app.exe')
     CLI(self.core).run()
     self.core.add.assert_called_once_with('app2', 'app.exe', False)
     _info.assert_not_called()
     _error.assert_called_once()
     exit.assert_called_once_with(1)
Example #3
0
 def test_listing_apps(self, CLIFeedback, exit, _info, _error):
     CLI(self.core).run()
     fb = CLIFeedback.return_value
     self.core.list_.assert_called_once_with(fb)
     fb.report_list.assert_called_once()
     _error.assert_not_called()
     exit.assert_not_called()
Example #4
0
 def test_scanning2(self, exit, _info, _error):
     self.core.scan.side_effect = ToolError('abc')
     CLI(self.core).run()
     self.core.scan.assert_called_once()
     _info.assert_called()
     _error.assert_called()
     exit.assert_called_once_with(1)
Example #5
0
    def test_importing2(self, exit, _info, _error):
        def check_inside_context(oc):
            inside_test_console_operation_control(oc)
            self.assertEqual(config.data_file, 'abc.txt')
            oc.interrupt()

        self.core.import_.side_effect = check_inside_context
        CLI(self.core).run()
        self.core.import_.assert_called_once()
        _info.assert_called()
        _error.assert_not_called()
        exit.assert_not_called()
Example #6
0
    def test_scanning(self, exit, _info, _error):

        def check_inside_context(oc):
            inside_test_console_operation_control(oc)
            self.assertEqual(config.port_scan_interval, 15)

        self.core.scan.side_effect = check_inside_context
        CLI(self.core).run()
        self.core.scan.assert_called_once()
        _info.assert_called()
        _error.assert_not_called()
        exit.assert_not_called()
Example #7
0
 def test_removing_executables(self, exit, _info, _error):
     CLI(self.core).run()
     self.core.remove_executable.assert_called_once_with('app.exe')
     _info.assert_not_called()
     _error.assert_not_called()
     exit.assert_not_called()
Example #8
0
 def test_purging_apps(self, exit, _info, _error):
     CLI(self.core).run()
     self.core.purge.assert_called_once_with('app1')
     _info.assert_not_called()
     _error.assert_not_called()
     exit.assert_not_called()
Example #9
0
 def test_adding_apps3(self, exit, _info, _error):
     CLI(self.core).run()
     self.core.add.assert_called_once_with('app2', 'app.exe', True)
     _info.assert_not_called()
     _error.assert_not_called()
     exit.assert_not_called()