예제 #1
0
def test_resolve_path_end():
    """Unit test for method test_resolve_path_end."""
    test_path_with_sep = '/just/a/test/path/'
    test_path_without_sep = '/just/a/test/path'

    expected_return = '/just/a/test/path'

    assert FileIO.resolve_path_end(test_path_with_sep) == expected_return
    assert FileIO.resolve_path_end(test_path_without_sep) == expected_return
예제 #2
0
def test_dump():
    """Unit test for method dump."""
    file_io = FileIO()

    file_io.dump(TEST_SCAN_DIR, tempfile.gettempdir())

    assert is_tarfile(
        os.path.join(
            tempfile.gettempdir(), '.'.join(
                (os.path.basename(file_io.resolve_path_end(TEST_SCAN_DIR)),
                 'pupyl'))))
예제 #3
0
def test_bind():
    """Unit test for method bind."""
    file_io = FileIO()

    file_io.dump(TEST_SCAN_DIR, tempfile.gettempdir())

    file_io.bind(
        os.path.join(
            tempfile.gettempdir(), '.'.join(
                (os.path.basename(file_io.resolve_path_end(TEST_SCAN_DIR)),
                 'pupyl'))), os.path.join(tempfile.gettempdir(),
                                          TEST_SCAN_DIR))

    assert os.path.isdir(os.path.join(tempfile.gettempdir(), TEST_SCAN_DIR))