Beispiel #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')
Beispiel #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)
Beispiel #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)
Beispiel #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')
Beispiel #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')
Beispiel #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')