~unity-2d-team/unity-2d/Shell-MultiMonitor

« back to all changes in this revision

Viewing changes to grackle/tests/test_model.py

  • Committer: William Grant
  • Date: 2012-01-22 11:01:25 UTC
  • Revision ID: william.grant@canonical.com-20120122110125-gd5wzvh60fnm5mrj
Template messages yay.

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
    tzoffset,
27
27
    tzutc,
28
28
    )
29
 
import fixtures
30
29
from pycassa.util import convert_uuid_to_time
31
30
 
32
31
from grackle.model import (
35
34
    )
36
35
 
37
36
 
38
 
TEST_MESSAGE = """\
 
37
TEMPLATE_MESSAGE = """\
39
38
From: sysadmin@example.com
40
39
To: developer@example.com
41
40
Subject: Everything is broken
42
 
Date: Sat, 1 Jan 2000 11:02:34 +1100
43
 
Message-Id: <aaaaaaaaaaaaa@example.com>
 
41
Date: {date}
 
42
Message-Id: {id}
44
43
 
45
44
Help, everything has just broken.
46
45
"""
47
46
 
 
47
TEST_MESSAGE = TEMPLATE_MESSAGE.format(
 
48
    date='Sat, 1 Jan 2000 11:02:34 +1100',
 
49
    id='<aaaaaaaaaaaaa@example.com>')
 
50
 
48
51
 
49
52
class TestParseMessage(unittest.TestCase):
50
53
 
63
66
            date)
64
67
 
65
68
 
66
 
class TestCassandra(fixtures.TestWithFixtures):
 
69
class TestAddMessage(unittest.TestCase):
67
70
 
68
71
    def test_add_message(self):
69
72
        c = CassandraConnection(
70
73
            os.environ['GRACKLE_TEST_KEYSPACE'], ['localhost:9160'])
71
 
 
72
74
        archive = next(_RandomNameSequence())
73
75
 
74
76
        # Write the message out to Cassandra, and read it back in.