root/trunk/_test_ftp_sync.py

Revision 816, 2.4 kB (checked in by schwa, 3 months ago)
Consider missing test directories.
  • Property svn:mime-type set to text/x-python
  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
Line 
1 # Copyright (C) 2007, Stefan Schwarzer
2 # All rights reserved.
3 #
4 # Redistribution and use in source and binary forms, with or without
5 # modification, are permitted provided that the following conditions are
6 # met:
7 #
8 # - Redistributions of source code must retain the above copyright
9 #   notice, this list of conditions and the following disclaimer.
10 #
11 # - Redistributions in binary form must reproduce the above copyright
12 #   notice, this list of conditions and the following disclaimer in the
13 #   documentation and/or other materials provided with the distribution.
14 #
15 # - Neither the name of the above author nor the names of the
16 #   contributors to the software may be used to endorse or promote
17 #   products derived from this software without specific prior written
18 #   permission.
19 #
20 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR
24 # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
32 # $Id$
33
34 import os
35 import shutil
36 import sys
37 import unittest
38
39 # assume the test subdirectories are or will be in the current directory
40 TEST_ROOT = os.getcwd()
41 sys.path.insert(0, os.path.dirname(TEST_ROOT))
42
43 import ftp_sync
44
45
46 class TestLocalToLocal(unittest.TestCase):
47     def setUp(self):
48         if not os.path.exists("test_empty"):
49             os.mkdir("test_empty")
50         if os.path.exists("test_target"):
51             shutil.rmtree("test_target")
52         os.mkdir("test_target")
53
54     def test_sync_empty_dir(self):
55         source = ftp_sync.LocalHost()
56         target = ftp_sync.LocalHost()
57         syncer = ftp_sync.Syncer(source, target)
58         source_dir = os.path.join(TEST_ROOT, "test_empty")
59         target_dir = os.path.join(TEST_ROOT, "test_target")
60         syncer.sync(source_dir, target_dir)
61
62
63 if __name__ == '__main__':
64     unittest.main()
65
Note: See TracBrowser for help on using the browser.