tests/svn_helper_test.py
changeset 63 9b1909e46633
parent 30 636baa95715c
child 180 a1c6123f9d06
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 This test (and the svn_helper module that it tests) requires the pysvn module.
       
    23 """
       
    24 
       
    25 __authors__ = [
       
    26   # alphabetical order by last name, please
       
    27   '"Todd Larsen" <tlarsen@google.com>',
       
    28 ]
       
    29 
       
    30 
       
    31 import os
       
    32 import pysvn
       
    33 import sys
       
    34 import unittest
       
    35 
       
    36 from ..scripts import svn_helper
       
    37 
       
    38 
       
    39 class SvnHelperTests(unittest.TestCase):
       
    40   """pysvn wrapper tests for the svn_helper.py module.
       
    41   """
       
    42 
       
    43   def setUp(self):
       
    44     self.client = pysvn.Client()
       
    45 
       
    46   def testLsFiles(self):
       
    47     """Test if lsFiles() contains only file entries, using the SoC SVN repo.
       
    48     """
       
    49     self.assert_(
       
    50         'svn_helper_test.py' in svn_helper.lsFiles(
       
    51             'http://soc.googlecode.com/svn/trunk/tests', client=self.client))
       
    52 
       
    53     self.assert_(
       
    54         'tests/' not in svn_helper.lsFiles(
       
    55             'http://soc.googlecode.com/svn/trunk', client=self.client))
       
    56 
       
    57   def testLsDirs(self):
       
    58     """Test if lsDirs() contains only dir entries, using the SoC SVN repo.
       
    59     """
       
    60     self.assert_(
       
    61         'tests/' in svn_helper.lsDirs(
       
    62             'http://soc.googlecode.com/svn/trunk', client=self.client))
       
    63 
       
    64     self.assert_(
       
    65         'svn_helper_test.py' not in svn_helper.lsDirs(
       
    66             'http://soc.googlecode.com/svn/trunk/tests', client=self.client))
       
    67 
       
    68   def testExists(self):
       
    69     """Test if exists() works on the the SoC SVN repo.
       
    70     """
       
    71     self.assertEqual(
       
    72         True, svn_helper.exists(
       
    73             'http://soc.googlecode.com/svn/trunk', client=self.client))
       
    74 
       
    75     self.assertEqual(
       
    76         False, svn_helper.exists(
       
    77             'http://soc.googlecode.com/svn/does_not_exist', client=self.client))