~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-23 00:16:32 UTC
  • Revision ID: william.grant@canonical.com-20120123001632-z6dig91md7qu91f6
Date filtering.

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
from tempfile import _RandomNameSequence
23
23
import time
24
24
import unittest
 
25
import uuid
25
26
 
26
27
from dateutil.tz import (
27
28
    tzoffset,
171
172
        self.assertIs(None, prev)
172
173
        self.assertMessages([], messages)
173
174
        self.assertIs(None, next)
 
175
 
 
176
    def test_date_filter(self):
 
177
        conn, archive = self.makeArchive()
 
178
        self.makeMessages(conn, archive, 10)
 
179
        start = datetime.datetime.utcfromtimestamp(250).replace(
 
180
            tzinfo=tzutc())
 
181
        finish = datetime.datetime.utcfromtimestamp(500).replace(
 
182
            tzinfo=tzutc())
 
183
        prev, messages, next = conn.get_messages(
 
184
            archive, 'date', 2, '', start_date=start, finish_date=finish)
 
185
        self.assertMessages([3, 4], messages)
 
186
        prev, messages, next = conn.get_messages(
 
187
            archive, 'date', 2, next, start_date=start, finish_date=finish)
 
188
        self.assertMessages([5], messages)