Exemplo n.º 1
0
    def test_constructs_haproxy_config_without_optionals(self):
        with patch_open() as (mock_open, mock_file):
            hooks.construct_haproxy_config('foo-globals', 'foo-defaults')

            mock_file.write.assert_called_with('foo-globals\n\n'
                                               'foo-defaults\n\n')
            mock_open.assert_called_with(hooks.default_haproxy_config, 'w')
Exemplo n.º 2
0
    def test_constructs_nothing_if_defaults_is_none(self):
        with patch_open() as (mock_open, mock_file):
            hooks.construct_haproxy_config('foo-globals', None,
                                           'foo-monitoring', 'foo-services')

            self.assertFalse(mock_open.called)
            self.assertFalse(mock_file.called)
Exemplo n.º 3
0
    def test_constructs_nothing_if_defaults_is_none(self):
        with patch_open() as (mock_open, mock_file):
            hooks.construct_haproxy_config('foo-globals', None,
                                           'foo-monitoring', 'foo-services')

            self.assertFalse(mock_open.called)
            self.assertFalse(mock_file.called)
Exemplo n.º 4
0
    def test_constructs_haproxy_config_without_optionals(self):
        with patch_open() as (mock_open, mock_file):
            hooks.construct_haproxy_config('foo-globals', 'foo-defaults')

            mock_file.write.assert_called_with(
                'foo-globals\n\n'
                'foo-defaults\n\n'
            )
            mock_open.assert_called_with(hooks.default_haproxy_config, 'w')
Exemplo n.º 5
0
    def test_constructs_haproxy_config(self):
        with patch_open() as (mock_open, mock_file):
            hooks.construct_haproxy_config('foo-globals', 'foo-defaults',
                                           'foo-monitoring', 'foo-services')

            mock_file.write.assert_called_with('foo-globals\n\n'
                                               'foo-defaults\n\n'
                                               'foo-monitoring\n\n'
                                               'foo-services\n\n')
            mock_open.assert_called_with(hooks.default_haproxy_config, 'w')
Exemplo n.º 6
0
    def test_constructs_haproxy_config(self):
        with patch_open() as (mock_open, mock_file):
            hooks.construct_haproxy_config('foo-globals', 'foo-defaults',
                                           'foo-monitoring', 'foo-services')

            mock_file.write.assert_called_with(
                'foo-globals\n\n'
                'foo-defaults\n\n'
                'foo-monitoring\n\n'
                'foo-services\n\n'
            )
            mock_open.assert_called_with(hooks.default_haproxy_config, 'w')