~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/services/timeline/tests/test_nestingtimedaction.py

  • Committer: Launchpad Patch Queue Manager
  • Date: 2011-04-20 05:05:32 UTC
  • mfrom: (12873.1.2 bug-766786)
  • Revision ID: launchpad@pqm.canonical.com-20110420050532-oajp1td5lg4amf8w
[r=lifeless][bug=766786] And the missing files.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Copyright 2010 Canonical Ltd.  This software is licensed under the
 
2
# GNU Affero General Public License version 3 (see the file LICENSE).
 
3
 
 
4
"""Tests of the TimedAction class."""
 
5
 
 
6
__metaclass__ = type
 
7
 
 
8
import datetime
 
9
 
 
10
import testtools
 
11
 
 
12
from lp.services.timeline.nestingtimedaction import NestingTimedAction
 
13
from lp.services.timeline.timeline import Timeline
 
14
 
 
15
 
 
16
class TestNestingTimedAction(testtools.TestCase):
 
17
 
 
18
    def test_finish_adds_action(self):
 
19
        timeline = Timeline()
 
20
        action = NestingTimedAction("Sending mail", None, timeline)
 
21
        action.finish()
 
22
        self.assertEqual(1, len(timeline.actions))
 
23
        self.assertEqual(datetime.timedelta(), timeline.actions[-1].duration)
 
24
 
 
25
    def test__init__sets_duration(self):
 
26
        action = NestingTimedAction("Sending mail", None)
 
27
        self.assertEqual(datetime.timedelta(), action.duration)