def test_get_parent_dir_doubleslash(): cs = CauSync(config, "/tmp/causync_src", "/tmp/causync_dest", 'sync') assert_equals(cs.get_parent_dir('/tmp/causync_src/test//'), '/tmp/causync_src') assert_equals(cs.get_parent_dir('/tmp//causync_src//test//'), '/tmp/causync_src') assert_equals(cs.get_parent_dir('/tmp///causync_src/test'), '/tmp/causync_src') assert_equals(cs.get_parent_dir('/tmp////causync_src/test'), '/tmp/causync_src')
def test_get_parent_dir(): cs = CauSync(config, "/tmp/causync_src", "/tmp/causync_dest", 'sync') assert_equals(cs.get_parent_dir('/tmp/causync_src/test'), '/tmp/causync_src') assert_equals(cs.get_parent_dir('/tmp/causync_src/test/'), '/tmp/causync_src') assert_equals(cs.get_parent_dir('/tmp/causync_src'), '/tmp') assert_equals(cs.get_parent_dir('/tmp/causync_src/'), '/tmp') assert_equals(cs.get_parent_dir('/tmp'), '/') assert_equals(cs.get_parent_dir('/tmp/'), '/') assert_equals(cs.get_parent_dir('/'), '/')
def test_get_parent_dir_toomuchroot2(): cs = CauSync(config, "/tmp/causync_src", "/tmp/causync_dest", 'sync') cs.get_parent_dir('//')