~daisy-pluckers/oops-repository/trunk

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# oops-repository is Copyright 2011 Canonical Ltd.
#
# Canonical Ltd ("Canonical") distributes the oops-repository source code under
# the GNU Affero General Public License, version 3 ("AGPLv3"). See the file
# LICENSE in the source tree for more information.

import time

from fixtures import EnvironmentVariableFixture
import pycassa
from testtools import TestCase

from oopsrepository import schema
from oopsrepository.testing.cassandra import TemporaryKeyspace


class TestCreateSchema(TestCase):

    def test_creates_columnfamily(self):
        keyspace = self.useFixture(TemporaryKeyspace()).keyspace
        config = dict(keyspace=keyspace)
        schema.create(config)
        pool = pycassa.connect(keyspace)
        cf = pycassa.ColumnFamily(pool, 'OOPS')
        cf.insert('key', {"date":time.time(), "URL":'a bit boring'})