def test_null_avatar(): with get_gitlab_trigger(missing_avatar_url=True) as trigger: namespace_data = trigger.list_build_source_namespaces() expected = { 'avatar_url': None, 'personal': False, 'title': u'someorg', 'url': u'http://gitlab.com/groups/someorg', 'score': 1, 'id': '2', } assert namespace_data == [expected]
def test_null_avatar(): with get_gitlab_trigger(missing_avatar_url=True) as trigger: namespace_data = trigger.list_build_source_namespaces() expected = { "avatar_url": None, "personal": False, "title": "someorg", "url": "http://gitlab.com/groups/someorg", "score": 1, "id": "2", } assert namespace_data == [expected]
def test_list_build_sources(): with get_gitlab_trigger() as trigger: sources = trigger.list_build_sources_for_namespace('someorg') assert sources == [{ 'last_updated': 1380548762, 'name': u'someproject', 'url': u'http://example.com/someorg/someproject', 'private': True, 'full_name': u'someorg/someproject', 'has_admin_permissions': False, 'description': '' }, { 'last_updated': 1380548762, 'name': u'anotherproject', 'url': u'http://example.com/someorg/anotherproject', 'private': False, 'full_name': u'someorg/anotherproject', 'has_admin_permissions': True, 'description': '', }]
def test_list_build_sources(): with get_gitlab_trigger() as trigger: sources = trigger.list_build_sources_for_namespace("someorg") assert sources == [ { "last_updated": 1380548762, "name": "someproject", "url": "http://example.com/someorg/someproject", "private": True, "full_name": "someorg/someproject", "has_admin_permissions": False, "description": "", }, { "last_updated": 1380548762, "name": "anotherproject", "url": "http://example.com/someorg/anotherproject", "private": False, "full_name": "someorg/anotherproject", "has_admin_permissions": True, "description": "", }, ]
def test_null_permissions(): with get_gitlab_trigger(add_permissions=False) as trigger: sources = trigger.list_build_sources_for_namespace("someorg") source = sources[0] assert source["has_admin_permissions"]
def test_load_dockerfile_contents(dockerfile_path, contents): with get_gitlab_trigger(dockerfile_path=dockerfile_path) as trigger: assert trigger.load_dockerfile_contents() == contents
def gitlab_trigger(): with get_gitlab_trigger() as t: yield t