1 # Copyright (C) Cmed Ltd, 2008, 2009
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU Lesser General Public License as
5 # published by the Free Software Foundation; either version 2.1 of the
6 # License, or (at your option) any later version.
8 # This program is distributed in the hope that it will be useful, but
9 # WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 # Lesser General Public License for more details.
13 # You should have received a copy of the GNU Lesser General Public
14 # License along with this program; if not, write to the Free Software
15 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
24 class ProcessListTest(unittest
.TestCase
):
26 def test_list_processes(self
):
27 # Assumes /proc is available
28 matches
= [proc
for proc
in cmd_env
.list_processes()
29 if proc
.get_pid() == os
.getpid()]
30 self
.assertEquals(len(matches
), 1)
31 self
.assertEquals(matches
[0].get_root_dir(), "/")
34 class IsPathBelowTest(unittest
.TestCase
):
37 cases
= [("/foo", "/foobar", False),
38 ("/foo", "/bar", False),
39 ("/foo", "/foo/bar", True),
40 ("/foo/", "/foo/bar", True)]
41 for parent
, child
, is_below
in cases
:
42 self
.assertEquals(cmd_env
.is_path_below(parent
, child
), is_below
)
45 if __name__
== "__main__":