1
# Copyright 2011 Canonical Ltd. This software is licensed under the
2
# GNU Affero General Public License version 3 (see the file LICENSE).
4
"""Tests for lp.testing.fixture."""
8
from ConfigParser import SafeConfigParser
9
from StringIO import StringIO
11
from fixtures import EnvironmentVariableFixture
13
from canonical.testing.layers import BaseLayer
14
from lp.services.rabbit.server import RabbitServer
15
from lp.testing import TestCase
18
class TestRabbitServer(TestCase):
22
def test_service_config(self):
23
# Rabbit needs to fully isolate itself: an existing per user
24
# .erlang.cookie has to be ignored, and ditto bogus HOME if other
25
# tests fail to cleanup.
26
self.useFixture(EnvironmentVariableFixture('HOME', '/nonsense/value'))
28
# RabbitServer pokes some .ini configuration into its config.
29
fixture = self.useFixture(RabbitServer())
30
service_config = SafeConfigParser()
31
service_config.readfp(StringIO(fixture.config.service_config))
32
self.assertEqual(["rabbitmq"], service_config.sections())
34
"host": "localhost:%d" % fixture.config.port,
39
observed = dict(service_config.items("rabbitmq"))
40
self.assertEqual(expected, observed)