~daisy-pluckers/oops-repository/trunk

« back to all changes in this revision

Viewing changes to oopsrepository/tests/test_cassandra_fixture.py

  • Committer: Robert Collins
  • Date: 2011-02-26 09:08:51 UTC
  • Revision ID: robert@canonical.com-20110226090851-6nr1o56sfyy2mbkm
Add a temp keyspace helper.

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
# the GNU Affero General Public License, version 3 ("AGPLv3"). See the file
5
5
# LICENSE in the source tree for more information.
6
6
 
 
7
import pycassa
 
8
from pycassa.system_manager import SystemManager
7
9
from testtools import TestCase
8
10
 
 
11
from oopsrepository.testing.cassandra import TemporaryKeyspace
 
12
 
 
13
class TestTemporaryKeyspace(TestCase):
 
14
 
 
15
    def test_manages_keyspace(self):
 
16
        fixture = TemporaryKeyspace()
 
17
        mgr = SystemManager()
 
18
        with fixture:
 
19
            keyspace = fixture.keyspace
 
20
            # The keyspace should be accessible.
 
21
            self.assertTrue(keyspace in mgr.list_keyspaces())
 
22
        # And deleted after the fixture is finished with.
 
23
        self.assertFalse(keyspace in mgr.list_keyspaces())
 
24