Пример #1
0
def test_list_build_source_namespaces():
    namespaces_expected = [
        {
            "personal": True,
            "score": 1,
            "avatar_url": "avatarurl",
            "id": "knownuser",
            "title": "knownuser",
            "url": "https://bitbucket.org/knownuser",
        },
        {
            "score": 2,
            "title": "someorg",
            "personal": False,
            "url": "https://bitbucket.org/someorg",
            "avatar_url": "avatarurl",
            "id": "someorg",
        },
    ]

    found = get_bitbucket_trigger().list_build_source_namespaces()
    found = sorted(found, key=lambda d: sorted(d.items()))

    namespaces_expected = sorted(namespaces_expected,
                                 key=lambda d: sorted(d.items()))
    assert found == namespaces_expected
Пример #2
0
def test_list_build_source_namespaces():
    namespaces_expected = [{
        'personal': True,
        'score': 1,
        'avatar_url': 'avatarurl',
        'id': 'knownuser',
        'title': 'knownuser',
        'url': 'https://bitbucket.org/knownuser',
    }, {
        'score': 2,
        'title': 'someorg',
        'personal': False,
        'url': 'https://bitbucket.org/someorg',
        'avatar_url': 'avatarurl',
        'id': 'someorg'
    }]

    found = get_bitbucket_trigger().list_build_source_namespaces()
    found.sort()

    namespaces_expected.sort()
    assert found == namespaces_expected
Пример #3
0
def test_load_dockerfile_contents(dockerfile_path, contents):
  trigger = get_bitbucket_trigger(dockerfile_path)
  assert trigger.load_dockerfile_contents() == contents
Пример #4
0
def bitbucket_trigger():
  return get_bitbucket_trigger()
Пример #5
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.
        ({