author | Pawel Solyga <Pawel.Solyga@gmail.com> |
Tue, 30 Sep 2008 16:49:54 +0000 | |
changeset 215 | d020c95b17b1 |
parent 180 | a1c6123f9d06 |
permissions | -rw-r--r-- |
30
636baa95715c
Helper module used by utility and tool scripts to access svn repositories.
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
1 |
#!/usr/bin/python2.5 |
636baa95715c
Helper module used by utility and tool scripts to access svn repositories.
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
2 |
# |
636baa95715c
Helper module used by utility and tool scripts to access svn repositories.
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
3 |
# Copyright 2008 the Melange authors. |
636baa95715c
Helper module used by utility and tool scripts to access svn repositories.
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
4 |
# |
636baa95715c
Helper module used by utility and tool scripts to access svn repositories.
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
5 |
# Licensed under the Apache License, Version 2.0 (the "License"); |
636baa95715c
Helper module used by utility and tool scripts to access svn repositories.
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
6 |
# you may not use this file except in compliance with the License. |
636baa95715c
Helper module used by utility and tool scripts to access svn repositories.
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
7 |
# You may obtain a copy of the License at |
636baa95715c
Helper module used by utility and tool scripts to access svn repositories.
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
8 |
# |
636baa95715c
Helper module used by utility and tool scripts to access svn repositories.
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
9 |
# http://www.apache.org/licenses/LICENSE-2.0 |
636baa95715c
Helper module used by utility and tool scripts to access svn repositories.
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
10 |
# |
636baa95715c
Helper module used by utility and tool scripts to access svn repositories.
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
11 |
# Unless required by applicable law or agreed to in writing, software |
636baa95715c
Helper module used by utility and tool scripts to access svn repositories.
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
12 |
# distributed under the License is distributed on an "AS IS" BASIS, |
636baa95715c
Helper module used by utility and tool scripts to access svn repositories.
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
13 |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
636baa95715c
Helper module used by utility and tool scripts to access svn repositories.
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
14 |
# See the License for the specific language governing permissions and |
636baa95715c
Helper module used by utility and tool scripts to access svn repositories.
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
15 |
# limitations under the License. |
636baa95715c
Helper module used by utility and tool scripts to access svn repositories.
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
16 |
|
636baa95715c
Helper module used by utility and tool scripts to access svn repositories.
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
17 |
"""Tests for the scripts.svn_helper module. |
636baa95715c
Helper module used by utility and tool scripts to access svn repositories.
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
18 |
|
636baa95715c
Helper module used by utility and tool scripts to access svn repositories.
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
19 |
For details on running the tests, see: |
636baa95715c
Helper module used by utility and tool scripts to access svn repositories.
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
20 |
http://code.google.com/p/soc/wiki/TestingGuidelines#Running_the_smoke_tests |
63
9b1909e46633
Move tests/ to top level of trunk/. Fix tests to run from new location. Add
Todd Larsen <tlarsen@google.com>
parents:
30
diff
changeset
|
21 |
|
9b1909e46633
Move tests/ to top level of trunk/. Fix tests to run from new location. Add
Todd Larsen <tlarsen@google.com>
parents:
30
diff
changeset
|
22 |
This test (and the svn_helper module that it tests) requires the pysvn module. |
30
636baa95715c
Helper module used by utility and tool scripts to access svn repositories.
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
23 |
""" |
636baa95715c
Helper module used by utility and tool scripts to access svn repositories.
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
24 |
|
636baa95715c
Helper module used by utility and tool scripts to access svn repositories.
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
25 |
__authors__ = [ |
636baa95715c
Helper module used by utility and tool scripts to access svn repositories.
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
26 |
# alphabetical order by last name, please |
636baa95715c
Helper module used by utility and tool scripts to access svn repositories.
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
27 |
'"Todd Larsen" <tlarsen@google.com>', |
636baa95715c
Helper module used by utility and tool scripts to access svn repositories.
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
28 |
] |
636baa95715c
Helper module used by utility and tool scripts to access svn repositories.
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
29 |
|
636baa95715c
Helper module used by utility and tool scripts to access svn repositories.
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
30 |
|
636baa95715c
Helper module used by utility and tool scripts to access svn repositories.
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
31 |
import os |
180 | 32 |
try: |
33 |
import pysvn |
|
34 |
except: |
|
35 |
pysvn = None |
|
30
636baa95715c
Helper module used by utility and tool scripts to access svn repositories.
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
36 |
import sys |
636baa95715c
Helper module used by utility and tool scripts to access svn repositories.
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
37 |
import unittest |
636baa95715c
Helper module used by utility and tool scripts to access svn repositories.
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
38 |
|
180 | 39 |
if pysvn is not None: |
40 |
from ..scripts import svn_helper |
|
30
636baa95715c
Helper module used by utility and tool scripts to access svn repositories.
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
41 |
|
636baa95715c
Helper module used by utility and tool scripts to access svn repositories.
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
42 |
|
180 | 43 |
class SvnHelperTests(unittest.TestCase): |
44 |
"""pysvn wrapper tests for the svn_helper.py module. |
|
45 |
""" |
|
30
636baa95715c
Helper module used by utility and tool scripts to access svn repositories.
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
46 |
|
180 | 47 |
def setUp(self): |
48 |
self.client = pysvn.Client() |
|
30
636baa95715c
Helper module used by utility and tool scripts to access svn repositories.
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
49 |
|
180 | 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)) |
|
30
636baa95715c
Helper module used by utility and tool scripts to access svn repositories.
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
56 |
|
180 | 57 |
self.assert_( |
58 |
'tests/' not in svn_helper.lsFiles( |
|
59 |
'http://soc.googlecode.com/svn/trunk', client=self.client)) |
|
30
636baa95715c
Helper module used by utility and tool scripts to access svn repositories.
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
60 |
|
180 | 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)) |
|
30
636baa95715c
Helper module used by utility and tool scripts to access svn repositories.
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
67 |
|
180 | 68 |
self.assert_( |
69 |
'svn_helper_test.py' not in svn_helper.lsDirs( |
|
70 |
'http://soc.googlecode.com/svn/trunk/tests', client=self.client)) |
|
30
636baa95715c
Helper module used by utility and tool scripts to access svn repositories.
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
71 |
|
180 | 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)) |
|
30
636baa95715c
Helper module used by utility and tool scripts to access svn repositories.
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
78 |
|
180 | 79 |
self.assertEqual( |
80 |
False, svn_helper.exists( |
|
81 |
'http://soc.googlecode.com/svn/does_not_exist', client=self.client)) |