Beispiel #1
0
    def test_freeze_subdir(self):
        c = Castor(self.test_root)
        c.apply()
        del c

        with open(path.join(self.test_root, 'Castorfile'), 'r') as f:
            d = json.load(f)

        d['lodge'][2]['version'] = 'this-version-does-not-exist'

        with open(path.join(self.test_root, 'Castorfile'), 'w') as f:
            json.dump(d, f)

        c = Castor(self.test_root)
        c.update_versions()

        self.assertEqual(c.castorfile['lodge'][2]['version'], 'tag1')
Beispiel #2
0
    def test_freeze_subdir(self):
        c = Castor(self.test_root)
        c.apply()
        del c

        with open(path.join(self.test_root, "Castorfile"), "r") as f:
            d = json.load(f)

        d["lodge"][2]["version"] = "this-version-does-not-exist"

        with open(path.join(self.test_root, "Castorfile"), "w") as f:
            json.dump(d, f)

        c = Castor(self.test_root)
        c.update_versions()

        self.assertEqual(c.castorfile["lodge"][2]["version"], "tag1")
Beispiel #3
0
    def test_update_versions(self):
        c = Castor(self.test_root)
        c.apply()

        repo_dir = path.join(self.test_root, 'lodge')
        g = git.Git(repo_dir)
        g.checkout('master')

        modified_file = path.join(self.test_root, 'lodge', 'test.txt')
        with open(modified_file, 'w') as f:
            f.write('Saluton')

        r = git.Repo(repo_dir)
        r.index.add([modified_file])
        r.index.commit('Translated to Esperanto')
        r.create_tag('tag2')

        c.update_versions()

        self.assertEqual(c.castorfile['lodge'][0]['version'], 'tag2')
Beispiel #4
0
    def test_update_versions(self):
        c = Castor(self.test_root)
        c.apply()

        repo_dir = path.join(self.test_root, "lodge")
        g = git.Git(repo_dir)
        g.checkout("master")

        modified_file = path.join(self.test_root, "lodge", "test.txt")
        with open(modified_file, "w") as f:
            f.write("Saluton")

        r = git.Repo(repo_dir)
        r.index.add([modified_file])
        r.index.commit("Translated to Esperanto")
        r.create_tag("tag2")

        c.update_versions()

        self.assertEqual(c.castorfile["lodge"][0]["version"], "tag2")