예제 #1
0
def test_should_return_problem_if_no_coreapp_running(mocker):
    mocker.patch.object(docker_utils,
                        'get_running_wacore_containers',
                        return_value=[])
    mocker.patch.object(results, 'Problem', autospec=True)

    check_network.CheckNetworkAction().run(config=None)

    results.Problem.assert_called()
예제 #2
0
 def test_should_return_problem_if_at_least_one_host_not_reachable_on_https_port(
         self, mock_problem, *_):
     check_network.CheckNetworkAction().run(config=None)
     mock_problem.assert_called_with(
         ANY,
         "Network connectivity check fails",
         "Cannot reach WhatsApp Server host1 on port 5222 or 443.\n"
         "Cannot reach WhatsApp Docker Repository host2 on port 5222 or 443.\n",
         ANY,
     )
예제 #3
0
def test_should_return_Ok_if_all_hosts_reachable(mocker):
    mocker.patch.object(docker_utils,
                        'get_running_wacore_containers',
                        return_value=[MockContainer()])
    mocker.patch.object(check_network,
                        'is_server_in_warning_state',
                        return_value=False)
    mocker.patch.object(check_network,
                        'is_server_in_error_state',
                        return_value=False)
    mocker.patch.object(results, 'OK', autospec=True)

    check_network.CheckNetworkAction().run(config=None)

    results.OK.assert_called()
예제 #4
0
def test_should_return_problem_if_at_least_one_host_not_reachable_on_https_port(
        mocker):
    mocker.patch.object(docker_utils,
                        'get_running_wacore_containers',
                        return_value=[MockContainer()])
    mocker.patch.object(check_network,
                        'is_server_in_warning_state',
                        return_value=True)
    mocker.patch.object(check_network,
                        'is_server_in_error_state',
                        side_effect=[True, False, False, True, False, True])
    mocker.patch.object(results, 'Problem', autospec=True)

    check_network.CheckNetworkAction().run(config=None)

    results.Problem.assert_called()
예제 #5
0
    def test_should_return_Ok_if_all_hosts_reachable(self, *_):
        check_network.CheckNetworkAction().run(config=None)

        results.OK.assert_called()
예제 #6
0
    def test_should_skip_if_no_coreapp_running(self, *_):
        check_network.CheckNetworkAction().run(config=None)

        results.Skipped.assert_called()
예제 #7
0
    def test_should_return_problem_if_no_coreapp_running(self, *_):
        check_network.CheckNetworkAction().run(config=None)

        results.Problem.assert_called()