Fix Issue 389 (Clicking list entry will not open new tab/window).
[Melange.git] / tests / svn_helper_test.py
blobe1b33197dbe5501ade228e0c2f41654856a3bb29
1 #!/usr/bin/python2.5
3 # Copyright 2008 the Melange authors.
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
17 """Tests for the scripts.svn_helper module.
19 For details on running the tests, see:
20 http://code.google.com/p/soc/wiki/TestingGuidelines#Running_the_smoke_tests
22 This test (and the svn_helper module that it tests) requires the pysvn module.
23 """
25 __authors__ = [
26 # alphabetical order by last name, please
27 '"Todd Larsen" <tlarsen@google.com>',
31 import os
32 try:
33 import pysvn
34 except:
35 pysvn = None
36 import sys
37 import unittest
39 if pysvn is not None:
40 from ..scripts import svn_helper
43 class SvnHelperTests(unittest.TestCase):
44 """pysvn wrapper tests for the svn_helper.py module.
45 """
47 def setUp(self):
48 self.client = pysvn.Client()
50 def testLsFiles(self):
51 """Test if lsFiles() contains only file entries, using the SoC SVN repo.
52 """
53 self.assert_(
54 'svn_helper_test.py' in svn_helper.lsFiles(
55 'http://soc.googlecode.com/svn/trunk/tests', client=self.client))
57 self.assert_(
58 'tests/' not in svn_helper.lsFiles(
59 'http://soc.googlecode.com/svn/trunk', client=self.client))
61 def testLsDirs(self):
62 """Test if lsDirs() contains only dir entries, using the SoC SVN repo.
63 """
64 self.assert_(
65 'tests/' in svn_helper.lsDirs(
66 'http://soc.googlecode.com/svn/trunk', client=self.client))
68 self.assert_(
69 'svn_helper_test.py' not in svn_helper.lsDirs(
70 'http://soc.googlecode.com/svn/trunk/tests', client=self.client))
72 def testExists(self):
73 """Test if exists() works on the the SoC SVN repo.
74 """
75 self.assertEqual(
76 True, svn_helper.exists(
77 'http://soc.googlecode.com/svn/trunk', client=self.client))
79 self.assertEqual(
80 False, svn_helper.exists(
81 'http://soc.googlecode.com/svn/does_not_exist', client=self.client))