root/trunk/_test_ftp_sync.py
| Revision 763, 2.2 kB (checked in by schwa, 3 weeks ago) | |
|---|---|
| |
| 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 | TEST_ROOT = "/home/schwa/sd/python/ftputil" |
| 40 | sys.path.insert(0, os.path.dirname(TEST_ROOT)) |
| 41 | |
| 42 | from ftputil import ftp_sync |
| 43 | |
| 44 | |
| 45 | class TestLocalToLocal(unittest.TestCase): |
| 46 | def setUp(self): |
| 47 | target_dir = os.path.join(TEST_ROOT, "test_target") |
| 48 | shutil.rmtree(target_dir) |
| 49 | os.mkdir(target_dir) |
| 50 | |
| 51 | def test_sync_empty_dir(self): |
| 52 | source = ftp_sync.LocalHost() |
| 53 | target = ftp_sync.LocalHost() |
| 54 | syncer = ftp_sync.Syncer(source, target) |
| 55 | source_dir = os.path.join(TEST_ROOT, "test_empty") |
| 56 | target_dir = os.path.join(TEST_ROOT, "test_target") |
| 57 | syncer.sync(source_dir, target_dir) |
| 58 | |
| 59 | |
| 60 | if __name__ == '__main__': |
| 61 | unittest.main() |
| 62 |
Note: See TracBrowser for help on using the browser.
