~osomon/moovida/plugin_dependencies_graph

« back to all changes in this revision

Viewing changes to elisa-plugins/elisa/plugins/poblesec/tests/test_history.py

  • Committer: Olivier Tilloy
  • Date: 2009-06-04 10:32:06 UTC
  • mfrom: (1074.1.315 relook)
  • Revision ID: olivier@fluendo.com-20090604103206-6ql519mywkfcog6z
Merged the latest moovida.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
# -*- coding: utf-8 -*-
2
 
# Elisa - Home multimedia server
3
 
# Copyright (C) 2007-2008 Fluendo Embedded S.L. (www.fluendo.com).
 
2
# Moovida - Home multimedia server
 
3
# Copyright (C) 2007-2009 Fluendo Embedded S.L. (www.fluendo.com).
4
4
# All rights reserved.
5
5
#
6
6
# This file is available under one of two license agreements.
7
7
#
8
8
# This file is licensed under the GPL version 3.
9
9
# See "LICENSE.GPL" in the root of this distribution including a special
10
 
# exception to use Elisa with Fluendo's plugins.
 
10
# exception to use Moovida with Fluendo's plugins.
11
11
#
12
 
# The GPL part of Elisa is also available under a commercial licensing
 
12
# The GPL part of Moovida is also available under a commercial licensing
13
13
# agreement from Fluendo.
14
 
# See "LICENSE.Elisa" in the root directory of this distribution package
 
14
# See "LICENSE.Moovida" in the root directory of this distribution package
15
15
# for details on that license.
16
16
#
17
17
# Author: Guido Amoruso <guidonte@fluendo.com>
30
30
from elisa.plugins.poblesec.history import History
31
31
 
32
32
 
 
33
class FakeModel(list):
 
34
    pass
 
35
 
33
36
class FakeController(PigmentController):
34
 
    pass
 
37
    model = FakeModel()
35
38
 
36
39
 
37
40
class BadControllerError(Exception):
222
225
    def test_go_back_broken_current(self):
223
226
        self.history.current = "Hijacked"
224
227
        self.history.go_back()
 
228
 
 
229
    def test_clear(self):
 
230
        dfr = self._append_controllers()
 
231
 
 
232
        def checks(result):
 
233
            self.failUnlessEqual(self.history.index, 0)
 
234
            self.failUnlessEqual(len(self.history._controllers), 1)
 
235
 
 
236
        dfr.addCallback(lambda result: self.history.clear())
 
237
        dfr.addCallback(checks)
 
238
 
 
239
        return dfr
 
240
 
 
241
    def test_marks(self):
 
242
        dfr = self._append_controllers()
 
243
 
 
244
        def in_foo_checks(result):
 
245
            self.failUnlessEqual(self.history.index, 2)
 
246
            self.failUnlessEqual(len(self.history._controllers), 3)
 
247
 
 
248
        def after_foo_checks(result):
 
249
            self.failUnlessEqual(self.history.index, 5)
 
250
            self.failUnlessEqual(len(self.history._controllers), 6)
 
251
 
 
252
        dfr.addCallback(lambda result: self.history.set_mark("foo"))
 
253
        dfr.addCallback(in_foo_checks)
 
254
        dfr.addCallback(lambda result: self._append_controllers())
 
255
        dfr.addCallback(after_foo_checks)
 
256
        dfr.addCallback(lambda result: self.history.goto_mark("foo"))
 
257
        dfr.addCallback(in_foo_checks)
 
258
 
 
259
        return dfr