~timo-jyrinki/ubuntu/trusty/pitivi/backport_utopic_fixes

« back to all changes in this revision

Viewing changes to tests/test_check.py

  • Committer: Package Import Robot
  • Author(s): Sebastian Dröge
  • Date: 2014-03-29 15:22:50 UTC
  • mto: (3.1.23 experimental)
  • mto: This revision was merged to the branch mainline in revision 44.
  • Revision ID: package-import@ubuntu.com-20140329152250-flg9onx416bqf3e3
Tags: upstream-0.93
Import upstream version 0.93

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# -*- coding: utf-8 -*-
 
2
# Pitivi video editor
 
3
#
 
4
#       tests/test_check.py
 
5
#
 
6
# Copyright (c) 2014, Alex Băluț <alexandru.balut@gmail.com>
 
7
#
 
8
# This program is free software; you can redistribute it and/or
 
9
# modify it under the terms of the GNU Lesser General Public
 
10
# License as published by the Free Software Foundation; either
 
11
# version 2.1 of the License, or (at your option) any later version.
 
12
#
 
13
# This program is distributed in the hope that it will be useful,
 
14
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
15
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
16
# Lesser General Public License for more details.
 
17
#
 
18
# You should have received a copy of the GNU Lesser General Public
 
19
# License along with this program; if not, write to the
 
20
# Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
 
21
# Boston, MA 02110-1301, USA.
 
22
 
 
23
from common import TestCase
 
24
 
 
25
from pitivi import check
 
26
 
 
27
 
 
28
class FakeDependency(check.Dependency):
 
29
    import_result = None
 
30
 
 
31
    def _try_importing_component(self):
 
32
        return self.import_result
 
33
 
 
34
 
 
35
class TestDependency(TestCase):
 
36
 
 
37
    def testBoolEvaluation(self):
 
38
        dependency = FakeDependency(modulename="module1", version_required_string=None)
 
39
        self.assertFalse(dependency)
 
40
        self.assertFalse(dependency.satisfied)
 
41
 
 
42
        dependency.check()
 
43
        self.assertFalse(dependency)
 
44
        self.assertFalse(dependency.satisfied)
 
45
 
 
46
        dependency.import_result = "something"
 
47
        dependency.check()
 
48
        self.assertTrue(dependency)
 
49
        self.assertTrue(dependency.satisfied)