scripts/tests/svn_helper_test.py
changeset 63 9b1909e46633
parent 62 1627b79c396a
child 64 b73eec62825a
equal deleted inserted replaced
62:1627b79c396a 63:9b1909e46633
     1 #!/usr/bin/python2.5
       
     2 #
       
     3 # Copyright 2008 the Melange authors.
       
     4 #
       
     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
       
     8 #
       
     9 #   http://www.apache.org/licenses/LICENSE-2.0
       
    10 #
       
    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.
       
    16 
       
    17 """Tests for the scripts.svn_helper module.
       
    18 
       
    19 For details on running the tests, see:
       
    20   http://code.google.com/p/soc/wiki/TestingGuidelines#Running_the_smoke_tests
       
    21 """
       
    22 
       
    23 __authors__ = [
       
    24   # alphabetical order by last name, please
       
    25   '"Todd Larsen" <tlarsen@google.com>',
       
    26 ]
       
    27 
       
    28 
       
    29 import os
       
    30 import pysvn
       
    31 import sys
       
    32 import unittest
       
    33 
       
    34 from .. import svn_helper
       
    35 
       
    36 
       
    37 class SvnHelperTests(unittest.TestCase):
       
    38   """pysvn wrapper tests for the svn_helper.py module.
       
    39   """
       
    40 
       
    41   def setUp(self):
       
    42     self.client = pysvn.Client()
       
    43 
       
    44   def testLsFiles(self):
       
    45     """Test if lsFiles() contains only file entries, using the SoC SVN repo.
       
    46     """
       
    47     self.assert_(
       
    48         'svn_helper_test.py' in svn_helper.lsFiles(
       
    49             self.client, '%strunk/scripts/tests' % svn_helper.DEF_SVN_REPO))
       
    50 
       
    51     self.assert_(
       
    52         'tests/' not in svn_helper.lsFiles(
       
    53             self.client, '%strunk/scripts' % svn_helper.DEF_SVN_REPO))
       
    54 
       
    55   def testLsDirs(self):
       
    56     """Test if lsDirs() contains only dir entries, using the SoC SVN repo.
       
    57     """
       
    58     self.assert_(
       
    59         'tests/' in svn_helper.lsDirs(
       
    60             self.client, '%strunk/scripts' % svn_helper.DEF_SVN_REPO))
       
    61 
       
    62     self.assert_(
       
    63         'svn_helper_test.py' not in svn_helper.lsDirs(
       
    64             self.client, '%strunk/scripts' % svn_helper.DEF_SVN_REPO))
       
    65 
       
    66   def testExists(self):
       
    67     """Test if exists() works on the the SoC SVN repo.
       
    68     """
       
    69     self.assertEqual(
       
    70         True, svn_helper.exists(self.client,
       
    71                                 svn_helper.DEF_SVN_REPO + 'trunk'))
       
    72 
       
    73     self.assertEqual(
       
    74         False, svn_helper.exists(self.client,
       
    75                                  svn_helper.DEF_SVN_REPO + 'does_not_exist'))