Example #1
0
def github_trigger():
    return get_github_trigger()
Example #2
0
def test_load_dockerfile_contents(dockerfile_path, contents):
    trigger = get_github_trigger(dockerfile_path)
    assert trigger.load_dockerfile_contents() == contents
Example #3
0
import pytest

from buildtrigger.triggerutil import TriggerStartException
from buildtrigger.test.bitbucketmock import get_bitbucket_trigger
from buildtrigger.test.githubmock import get_github_trigger
from endpoints.building import PreparedBuild


# Note: This test suite executes a common set of tests against all the trigger types specified
# in this fixture. Each trigger's mock is expected to return the same data for all of these calls.
@pytest.fixture(params=[get_github_trigger(), get_bitbucket_trigger()])
def githost_trigger(request):
    return request.param


@pytest.mark.parametrize(
    'run_parameters, expected_error, expected_message',
    [
        # No branch or tag specified: use the commit of the default branch.
        ({}, None, None),

        # Invalid branch.
        ({
            'refs': {
                'kind': 'branch',
                'name': 'invalid'
            }
        }, TriggerStartException, 'Could not find branch in repository'),

        # Invalid tag.
        ({