示例#1
0
def create_travis_files(full_name, github_token, config):
    """ Create the files required for Travis CI hooks to work. """

    created      = {}

    travis_files = get_travis_files_content(full_name, github_token, config)

    for file_ in travis_files:
        name          = file_['name']
        content       = file_['content']
        extra_payload = {
            'author': {
                'name': GIT_NAME,
                'email': GIT_EMAIL,
            },
            'committer': {
                'name': GIT_NAME,
                'email': GIT_EMAIL,
            },
            'message': file_['message']
        }

        created[name] = github_utils.commit(
            name, content, full_name, github_token, extra_payload
        )

    return created
示例#2
0
    def test_should_update_existing_path(self):
        # Given
        full_name = 'punchagan/experiri'
        content = path = self._get_random_string()
        author = {
            'name': 'Tests on Travis',
            'email': '*****@*****.**',
        }
        info = {
            'author': author,
            'committer': author,
        }
        github_utils.commit(path, content, full_name, GH_TOKEN, info)

        # When
        committed = github_utils.commit(path, content*2, full_name, GH_TOKEN)

        # Then
        self.assertTrue(committed)
示例#3
0
    def test_should_commit_new_file(self):
        # Given
        full_name = 'punchagan/experiri'
        content = path = self._get_random_string()
        author = {
            'name': 'Tests on Travis',
            'email': '*****@*****.**',
        }
        info = {
            'author': author,
            'committer': author,
        }

        # When
        committed = github_utils.commit(
            path, content, full_name, GH_TOKEN, extra_payload=info
        )

        # Then
        self.assertTrue(committed)
        self.assertTrue(github_utils.exists(full_name, path, GH_TOKEN))