Exemplo n.º 1
0
    def test_calls_different_actions(self, mock_call):
        mock_call.return_value = 0

        result = hooks.service_haproxy('foo')

        self.assertTrue(result)
        mock_call.assert_called_with(['service', 'haproxy', 'foo'])
Exemplo n.º 2
0
    def test_calls_check_action_with_different_config(self, mock_call):
        mock_call.return_value = 0

        result = hooks.service_haproxy('check', 'some-config')

        self.assertTrue(result)
        mock_call.assert_called_with(['/usr/sbin/haproxy', '-f',
                                      'some-config', '-c'])
Exemplo n.º 3
0
    def test_calls_check_action(self, mock_call):
        mock_call.return_value = 0

        result = hooks.service_haproxy('check')

        self.assertTrue(result)
        mock_call.assert_called_with(
            ['/usr/sbin/haproxy', '-f', hooks.default_haproxy_config, '-c'])
Exemplo n.º 4
0
    def test_calls_check_action(self, mock_call):
        mock_call.return_value = 0

        result = hooks.service_haproxy('check')

        self.assertTrue(result)
        mock_call.assert_called_with(['/usr/sbin/haproxy', '-f',
                                      hooks.default_haproxy_config, '-c'])
Exemplo n.º 5
0
    def test_calls_check_action_with_different_config(self, mock_call):
        mock_call.return_value = 0

        result = hooks.service_haproxy('check', 'some-config')

        self.assertTrue(result)
        mock_call.assert_called_with(
            ['/usr/sbin/haproxy', '-f', 'some-config', '-c'])
Exemplo n.º 6
0
 def test_doesnt_call_actions_if_config_is_none(self, mock_call):
     self.assertIsNone(hooks.service_haproxy('foo', None))
     self.assertFalse(mock_call.called)
Exemplo n.º 7
0
 def test_doesnt_call_actions_if_action_not_provided(self, mock_call):
     self.assertIsNone(hooks.service_haproxy())
     self.assertFalse(mock_call.called)
Exemplo n.º 8
0
    def test_fails_to_call_different_actions(self, mock_call):
        mock_call.return_value = 1

        result = hooks.service_haproxy('foo')

        self.assertFalse(result)
Exemplo n.º 9
0
    def test_fails_to_check_config(self, mock_call):
        mock_call.return_value = 1

        result = hooks.service_haproxy('check')

        self.assertFalse(result)
Exemplo n.º 10
0
    def test_fails_to_check_config(self, mock_call):
        mock_call.return_value = 1

        result = hooks.service_haproxy('check')

        self.assertFalse(result)
Exemplo n.º 11
0
 def test_doesnt_call_actions_if_config_is_none(self, mock_call):
     self.assertIsNone(hooks.service_haproxy('foo', None))
     self.assertFalse(mock_call.called)
Exemplo n.º 12
0
 def test_doesnt_call_actions_if_action_not_provided(self, mock_call):
     self.assertIsNone(hooks.service_haproxy())
     self.assertFalse(mock_call.called)
Exemplo n.º 13
0
    def test_fails_to_call_different_actions(self, mock_call):
        mock_call.return_value = 1

        result = hooks.service_haproxy('foo')

        self.assertFalse(result)