Ejemplo n.º 1
0
    def test_can_get_repository_tags(self):
        repo = str(uuid.uuid4())
        create_repository(repo)
        tag_repo(repo, 'my-tag')

        result = self.gandalf.repository_tags(repo)
        expect(result[0]).to_include('name')
        expect(result[0]['name']).to_equal('my-tag')
Ejemplo n.º 2
0
    def test_can_get_repository_tags_annotated_no_message(self):
        repo = str(uuid.uuid4())
        create_repository(repo)
        tag_repo(repo, 'my-annotated-tag', '')

        result = self.gandalf.repository_tags(repo)
        expect(result[0]).to_include('name')
        expect(result[0]['name']).to_equal('my-annotated-tag')
        expect(result[0]).to_include('subject')
        expect(result[0]['subject']).to_equal('')
Ejemplo n.º 3
0
    def test_can_get_repository_tags_with_git_committer(self):
        repo = str(uuid.uuid4())
        create_repository(repo)
        tag_repo(repo, 'my-tag')

        result = self.gandalf.repository_tags(repo)
        expect(result[0]).to_include('name')
        expect(result[0]['name']).to_equal('my-tag')
        expect(result[0]).to_include('committer')
        expect(result[0]['committer']['name']).to_equal('committer')
        expect(result[0]['committer']['email']).to_equal('<*****@*****.**>')
Ejemplo n.º 4
0
    def test_can_get_repository_contents(self):
        repo = str(uuid.uuid4())
        create_repository(repo)
        add_file_to_repo(repo, 'some/path/doge.txt', 'FOO BAR')
        tag_repo(repo, '0.1.0')
        add_file_to_repo(repo, 'some/path/doge.txt', 'OTHER TEST')

        content = self.gandalf.repository_contents(repo, 'some/path/doge.txt', '0.1.0')
        expect(content).to_equal('FOO BAR\n')

        content = self.gandalf.repository_contents(repo, 'some/path/doge.txt')
        expect(content).to_equal('OTHER TEST\n')
Ejemplo n.º 5
0
    def test_can_get_tree_with_path_for_ref(self):
        create_repository('test3')
        add_file_to_repo('test3', 'some/path/doge.txt', 'VERY COMMIT')
        tag_repo('test3', '0.1.0')
        add_file_to_repo('test3', 'some/path/to/add.txt', 'MUCH WOW')

        tree = yield self.gandalf.repository_tree('test3', '/some/path/', '0.1.0')

        expect(tree).to_length(1)
        expect(tree[0]).to_be_like({
            u'rawPath': u'some/path/doge.txt',
            u'path': u'some/path/doge.txt',
            u'filetype': u'blob',
            u'hash': u'cb508ee85be1e116233ae7c18e2d9bcc9553d209',
            u'permission': u'100644'
        })
Ejemplo n.º 6
0
    def test_can_diff_commits(self):
        repo = str(uuid.uuid4())
        create_repository(repo)
        add_file_to_repo(repo, 'some/path/doge.txt', 'FOO BAR')
        tag_repo(repo, '0.1.0')
        add_file_to_repo(repo, 'some/path/doge.txt', 'OTHER TEST')

        diff = self.gandalf.repository_diff_commits(repo, '0.1.0', 'master')
        expected = """diff --git a/some/path/doge.txt b/some/path/doge.txt
index 404727f..bd82f1d 100644
--- a/some/path/doge.txt
+++ b/some/path/doge.txt
@@ -1 +1 @@
-FOO BAR
+OTHER TEST
"""
        expect(expected).to_equal(diff)
Ejemplo n.º 7
0
    def test_can_get_repository_tags_annotated_with_git_tagger(self):
        repo = str(uuid.uuid4())
        create_repository(repo)
        tag_repo(repo, 'my-annotated-tag', 'annotated tag')

        result = self.gandalf.repository_tags(repo)
        expect(result[0]).to_include('name')
        expect(result[0]['name']).to_equal('my-annotated-tag')
        expect(result[0]).to_include('subject')
        expect(result[0]['subject']).to_equal('annotated tag')
        expect(result[0]).to_include('tagger')
        expect(result[0]['tagger']['name']).to_equal('tagger')
        expect(result[0]['tagger']['email']).to_equal('<*****@*****.**>')
        expect(result[0]).to_include('author')
        expect(result[0]['author']['name']).to_be_empty()
        expect(result[0]['author']['email']).to_be_empty()
        expect(result[0]).to_include('committer')
        expect(result[0]['committer']['name']).to_be_empty()
        expect(result[0]['committer']['email']).to_be_empty()
Ejemplo n.º 8
0
    def test_can_get_repository_archive(self):
        repo = str(uuid.uuid4())
        create_repository(repo)
        add_file_to_repo(repo, 'some/path/doge.txt', 'FOO BAR')
        tag_repo(repo, '0.1.0')
        add_file_to_repo(repo, 'some/path/doge.txt', 'OTHER TEST')

        tar = self.gandalf.repository_archive(repo, 'master', 'tar')
        tar.extract('{0}-master/some/path/doge.txt'.format(repo), TMP_DIR)
        archive = open(os.path.join(TMP_DIR, '{0}-master/some/path/doge.txt'.format(repo)), 'r')
        content = archive.read()
        archive.close()
        expect(content).to_equal('OTHER TEST\n')

        zip_ = self.gandalf.repository_archive(repo, '0.1.0')
        zip_.extract('{0}-0.1.0/some/path/doge.txt'.format(repo), TMP_DIR)
        archive = open(os.path.join(TMP_DIR, '{0}-0.1.0/some/path/doge.txt'.format(repo)), 'r')
        content = archive.read()
        archive.close()
        expect(content).to_equal('FOO BAR\n')