Esempio n. 1
0
 def test_CreationOfGitIgnore_DoesntExist_ShouldGetCreated(self):
     with testhelper.mkchdir("aFolder") as folder:
         configuration.config = Builder().setworkdirectory(folder).setgitreponame("test.git").build()
         ignore = '.gitignore'
         Initializer().createrepo()
         Initializer.createignore()
         gitignorepath = os.path.join(os.getcwd(), ignore)
         self.assertTrue(os.path.exists(gitignorepath))
Esempio n. 2
0
 def test_CreationOfGitIgnore_ExistAlready_ShouldntGetCreated(self):
     with testhelper.mkchdir("aFolder") as folder:
         configuration.config = Builder().setworkdirectory(folder).setgitreponame("test.git").build()
         ignore = '.gitignore'
         existing_git_ignore_entry = "test"
         Initializer().createrepo()
         with open(ignore, 'w') as gitIgnore:
             gitIgnore.write(existing_git_ignore_entry)
         Initializer.createignore()
         with open(ignore, 'r') as gitIgnore:
             for line in gitIgnore.readlines():
                 self.assertEqual(existing_git_ignore_entry, line)
Esempio n. 3
0
 def test_CreationOfGitIgnore_DoesntExist_ShouldGetCreated_WithDirectories(self):
     with testhelper.mkchdir("aFolder") as folder:
         configuration.config = Builder().setworkdirectory(folder).setgitreponame("test.git").setignoredirectories(["projectX/dist", "projectZ/out"]).build()
         ignore = '.gitignore'
         Initializer().createrepo()
         Initializer.createignore()
         gitignorepath = os.path.join(os.getcwd(), ignore)
         self.assertTrue(os.path.exists(gitignorepath))
         expectedlines = []
         expectedlines.append(".jazz5\n")
         expectedlines.append(".metadata\n")
         expectedlines.append(".jazzShed\n")
         expectedlines.append("\n")
         expectedlines.append("# directories\n")
         expectedlines.append("/projectX/dist\n")
         expectedlines.append("/projectZ/out\n")
         expectedlines.append("\n")
         with open(gitignorepath, 'r') as gitignore:
             lines = gitignore.readlines()
             self.assertEqual(expectedlines, lines)