# Path: vimswitch/test/BaseTestCase.py
# class BaseTestCase(unittest.TestCase):
#     def __init__(self, *args, **kwargs):
#         unittest.TestCase.__init__(self, *args, **kwargs)
# 
#         # Python < 3.2 does not have assertNotRegex
#         if not hasattr(self, 'assertNotRegex'):
#             self.assertNotRegex = self.assertNotRegexpMatches
# 
#     def assertMultilineRegexpMatches(self, string, regexp):
#         """
#         Asserts that the entirety of `string` matches `regexp`. `regexp` can be
#         a multiline string with indentation.
#         """
#         regexp = textwrap.dedent(regexp)
#         regexp = regexp.strip()
#         regexp = '^' + regexp + '$'
#         regexp = re.compile(regexp, re.DOTALL)
# 
#         self.assertRegexpMatches(string, regexp)
# 
#     def assertStdout(self, stdout, regexp):
#         "Asserts that the `stdout` io stream matches `regexp`"
#         stdoutText = stdout.getvalue().strip()
#         self.assertMultilineRegexpMatches(stdoutText, regexp)
# 
#     def resetStdout(self, stdout):
#         stdout.seek(0)
#         stdout.truncate(0)
# 
# Path: vimswitch/test/TestHelpers.py
# def assertNoCall(mock, *args):
#     calledWith = False
#     try:
#         mock.assert_any_call(*args)
#         calledWith = True
#     except AssertionError:
#         pass
# 
#     if calledWith:
#         raise AssertionError('Mock called with arguments', mock, args)
# 
# Path: vimswitch/ProfileDataIo.py
# class ProfileDataIo:
#     def __init__(self, settings, diskIo):
#         self.settings = settings
#         self.diskIo = diskIo
# 
#     def delete(self, path):
#         """Deletes profile data found at path"""
#         for file in self.settings.profileFiles:
#             filePath = os.path.join(path, file)
#             if self.diskIo.fileExists(filePath):
#                 self.diskIo.deleteFile(filePath)
# 
#         for dir in self.settings.profileDirs:
#             dirPath = os.path.join(path, dir)
#             if self.diskIo.dirExists(dirPath):
#                 self.diskIo.deleteDir(dirPath)
# 
#     def copy(self, srcPath, destPath):
#         """
#         Copies profile data from srcPath to destPath. Will replace existing
#         files at destPath.
#         """
#         for file in self.settings.profileFiles:
#             srcFilePath = os.path.join(srcPath, file)
#             destFilePath = os.path.join(destPath, file)
#             if self.diskIo.fileExists(srcFilePath):
#                 self.diskIo.copyFile(srcFilePath, destFilePath)
# 
#         for dir in self.settings.profileDirs:
#             srcDirPath = os.path.join(srcPath, dir)
#             destDirPath = os.path.join(destPath, dir)
#             if self.diskIo.dirExists(srcDirPath):
#                 self.diskIo.copyDir(srcDirPath, destDirPath)
# 
# Path: vimswitch/Settings.py
# class Settings:
# 
#     def __init__(self, homePath=''):
#         """
#         homePath is used as the prefix for all other paths. If homePath is not
#         specified it gets set to the user's home directory.
#         """
#         self.homePath = homePath or os.path.expanduser('~')
#         self.configPath = os.path.join(self.homePath, '.vimswitch')
#         self.configFilePath = os.path.join(self.configPath, 'vimswitchrc')
#         self.cachePath = os.path.join(self.configPath, 'profiles')
#         self.downloadsPath = os.path.join(self.configPath, 'downloads')
#         self.profileFiles = ['.vimrc', '_vimrc']
#         self.profileDirs = ['.vim', '_vim']
#         self.defaultProfile = Profile('default')
#         self.currentProfile = None
# 
#     def __eq__(self, other):
#         return self.__dict__ == other.__dict__


from . import Stubs
from .BaseTestCase import BaseTestCase
from .TestHelpers import assertNoCall
from vimswitch.ProfileDataIo import ProfileDataIo
from vimswitch.Settings import Settings
import os


class TestProfileDataIo(BaseTestCase):
    def setUp(self):
        self.diskIo = Stubs.DiskIoStub()
        self.settings = Settings(os.path.normpath('/home/foo'))

# Path: vimswitch/test/BaseTestCase.py
# class BaseTestCase(unittest.TestCase):
#     def __init__(self, *args, **kwargs):
#         unittest.TestCase.__init__(self, *args, **kwargs)
# 
#         # Python < 3.2 does not have assertNotRegex
#         if not hasattr(self, 'assertNotRegex'):
#             self.assertNotRegex = self.assertNotRegexpMatches
# 
#     def assertMultilineRegexpMatches(self, string, regexp):
#         """
#         Asserts that the entirety of `string` matches `regexp`. `regexp` can be
#         a multiline string with indentation.
#         """
#         regexp = textwrap.dedent(regexp)
#         regexp = regexp.strip()
#         regexp = '^' + regexp + '$'
#         regexp = re.compile(regexp, re.DOTALL)
# 
#         self.assertRegexpMatches(string, regexp)
# 
#     def assertStdout(self, stdout, regexp):
#         "Asserts that the `stdout` io stream matches `regexp`"
#         stdoutText = stdout.getvalue().strip()
#         self.assertMultilineRegexpMatches(stdoutText, regexp)
# 
#     def resetStdout(self, stdout):
#         stdout.seek(0)
#         stdout.truncate(0)
# 
# Path: vimswitch/test/TestHelpers.py
# def assertNoCall(mock, *args):
#     calledWith = False
#     try:
#         mock.assert_any_call(*args)
#         calledWith = True
#     except AssertionError:
#         pass
# 
#     if calledWith:
#         raise AssertionError('Mock called with arguments', mock, args)
# 
# Path: vimswitch/ProfileDataIo.py
# class ProfileDataIo:
#     def __init__(self, settings, diskIo):
#         self.settings = settings
#         self.diskIo = diskIo
# 
#     def delete(self, path):
#         """Deletes profile data found at path"""
#         for file in self.settings.profileFiles:
#             filePath = os.path.join(path, file)
#             if self.diskIo.fileExists(filePath):
#                 self.diskIo.deleteFile(filePath)
# 
#         for dir in self.settings.profileDirs:
#             dirPath = os.path.join(path, dir)
#             if self.diskIo.dirExists(dirPath):
#                 self.diskIo.deleteDir(dirPath)
# 
#     def copy(self, srcPath, destPath):
#         """
#         Copies profile data from srcPath to destPath. Will replace existing
#         files at destPath.
#         """
#         for file in self.settings.profileFiles:
#             srcFilePath = os.path.join(srcPath, file)
#             destFilePath = os.path.join(destPath, file)
#             if self.diskIo.fileExists(srcFilePath):
#                 self.diskIo.copyFile(srcFilePath, destFilePath)
# 
#         for dir in self.settings.profileDirs:
#             srcDirPath = os.path.join(srcPath, dir)
#             destDirPath = os.path.join(destPath, dir)
#             if self.diskIo.dirExists(srcDirPath):
#                 self.diskIo.copyDir(srcDirPath, destDirPath)
# 
# Path: vimswitch/Settings.py
# class Settings:
# 
#     def __init__(self, homePath=''):
#         """
#         homePath is used as the prefix for all other paths. If homePath is not
#         specified it gets set to the user's home directory.
#         """
#         self.homePath = homePath or os.path.expanduser('~')
#         self.configPath = os.path.join(self.homePath, '.vimswitch')
#         self.configFilePath = os.path.join(self.configPath, 'vimswitchrc')
#         self.cachePath = os.path.join(self.configPath, 'profiles')
#         self.downloadsPath = os.path.join(self.configPath, 'downloads')
#         self.profileFiles = ['.vimrc', '_vimrc']
#         self.profileDirs = ['.vim', '_vim']
#         self.defaultProfile = Profile('default')
#         self.currentProfile = None
# 
#     def __eq__(self, other):
#         return self.__dict__ == other.__dict__


# Path: vimswitch/test/test_ProfileDataIo.py
from . import Stubs
from .BaseTestCase import BaseTestCase
from .TestHelpers import assertNoCall
from vimswitch.ProfileDataIo import ProfileDataIo
from vimswitch.Settings import Settings
import os



class TestProfileDataIo(BaseTestCase):
    def setUp(self):
        self.diskIo = Stubs.DiskIoStub()
        self.settings = Settings(os.path.normpath('/home/foo'))

        self.profileDataIo = ProfileDataIo(self.settings, self.diskIo)