def test_directoryContainingFile(self): """ For a key associated with a value of a C{dict} with a key associated with a value of a C{str}, L{createSubversionRepository} should create a directory containing a file with the specified string as its content. """ directory = 'dirname' file = 'filename' content = 'bytes' createSubversionRepository(self.repository, {directory: { file: content }}, False, self.runCommand) repo = self.repository.path wc = self.workingCopy.path self.assertEqual(self.commands, [ ("svnadmin create " + repo, None), ("svn co file://" + repo + " " + wc, None), ("svn add " + self.workingCopy.child(directory).path, [self.workingCopy.child(directory)]), ("svn add " + self.workingCopy.child(directory).child(file).path, [ self.workingCopy.child(directory), self.workingCopy.child(directory).child(file) ]), ("svn commit -m 'Create specified files' " + self.workingCopy.path, [ self.workingCopy.child(directory), self.workingCopy.child(directory).child(file) ]) ])
def test_directoryContainingFile(self): """ For a key associated with a value of a C{dict} with a key associated with a value of a C{str}, L{createSubversionRepository} should create a directory containing a file with the specified string as its content. """ directory = 'dirname' file = 'filename' content = 'bytes' createSubversionRepository( self.repository, {directory: {file: content}}, False, self.runCommand) repo = self.repository.path wc = self.workingCopy.path self.assertEqual( self.commands, [("svnadmin create " + repo, None), ("svn co file://" + repo + " " + wc, None), ("svn add " + self.workingCopy.child(directory).path, [self.workingCopy.child(directory)]), ("svn add " + self.workingCopy.child(directory).child(file).path, [self.workingCopy.child(directory), self.workingCopy.child(directory).child(file)]), ("svn commit -m 'Create specified files' " + self.workingCopy.path, [self.workingCopy.child(directory), self.workingCopy.child(directory).child(file)])])
def createRepository(self, projectName, contents): """ Create a new SVN repository with the given contents and associate it with given project. """ path = self.repositories.child(projectName) path.makedirs() createSubversionRepository(path, contents)
def test_emptyRepository(self): """ L{createSubversionRepository} should create a repository with no entries or revisions if it is passed an empty dictionary. """ createSubversionRepository(self.repository, {}, False, self.commands.append) self.assertEqual( self.commands, ["svnadmin create " + self.repository.path])
def test_emptyRepository(self): """ L{createSubversionRepository} should create a repository with no entries or revisions if it is passed an empty dictionary. """ createSubversionRepository(self.repository, {}, False, self.commands.append) self.assertEqual(self.commands, ["svnadmin create " + self.repository.path])
def setUp(self): """ Compute the path and URL to a subversion repository which can be tested against and set up standard out to be recorded and hidden. """ self.repository = FilePath(self.mktemp()) createSubversionRepository(self.repository, {'foo': {}}) self.url = 'file://' + self.repository.path self.stdout = sys.stdout sys.stdout = StringIO.StringIO()
def test_workingCopyRemoved(self): """ The temporary working copy should be deleted after L{createSubversionRepository} is finished using it to populate the repository if C{True} is passed for the I{cleanup} parameter. """ createSubversionRepository( self.repository, {'file': 'bytes'}, True, self.runCommand) self.workingCopy.restat(False) self.assertFalse(self.workingCopy.exists())
def test_workingCopyRemoved(self): """ The temporary working copy should be deleted after L{createSubversionRepository} is finished using it to populate the repository if C{True} is passed for the I{cleanup} parameter. """ createSubversionRepository(self.repository, {'file': 'bytes'}, True, self.runCommand) self.workingCopy.restat(False) self.assertFalse(self.workingCopy.exists())
def _fileTest(self, entry, contents): """ """ createSubversionRepository( self.repository, {entry: contents}, False, self.runCommand) repo = self.repository.path wc = self.workingCopy.path self.assertEqual( self.commands, [("svnadmin create " + repo, None), ("svn co file://" + repo + " " + wc, None), ("svn add " + self.workingCopy.child(entry).path, [self.workingCopy.child(entry)]), ("svn commit -m 'Create specified files' " + self.workingCopy.path, [self.workingCopy.child(entry)])])
def _fileTest(self, entry, contents): """ """ createSubversionRepository(self.repository, {entry: contents}, False, self.runCommand) repo = self.repository.path wc = self.workingCopy.path self.assertEqual(self.commands, [ ("svnadmin create " + repo, None), ("svn co file://" + repo + " " + wc, None), ("svn add " + self.workingCopy.child(entry).path, [self.workingCopy.child(entry)]), ("svn commit -m 'Create specified files' " + self.workingCopy.path, [self.workingCopy.child(entry)]) ])