def test_get_push_details_syntax(push_map_data, expected): remote_url = 'remote_url' if isinstance(expected, type) and issubclass(expected, Exception): with pytest.raises(expected): get_push_details(push_map_data, remote_url) else: out = get_push_details(push_map_data, remote_url) assert isinstance(out, PushDetails) assert out.push_url == expected
def test_get_push_details_order(remote_url, expected): push_map_data = [ {'^(/.*)': dict( push_url='\\1', )}, {'^(/moved.*)': dict( push_url='/location_of\\1', )}, ] if isinstance(expected, type) and issubclass(expected, Exception): with pytest.raises(expected): get_push_details(push_map_data, remote_url) else: out = get_push_details(push_map_data, remote_url) assert isinstance(out, PushDetails) assert out.push_url == expected
def test_get_push_details_expansion(push_map_data, remote_url, expected): out = get_push_details(push_map_data, remote_url) assert isinstance(out, PushDetails) assert out.push_url == expected.push_url assert out.host_key == expected.host_key assert out.merge_flags == expected.merge_flags assert out.maintainer_groups == expected.maintainer_groups assert out.maintainers == expected.maintainers assert out == expected
def test_get_push_details(remote_url, expected): push_map_data = [ {'^https://plain-remote/repo.git$': dict( push_url='ssh://plain-remote/repo.git', )}, {'^https://matched-remote/(.*)$': dict( push_url='ssh://matched-remote/\\1', )}, {'^(/moved.*)': dict( push_url='/location_of\\1', )}, {'^(/.*)': dict( push_url='\\1', )}, ] if isinstance(expected, type) and issubclass(expected, Exception): with pytest.raises(expected): get_push_details(push_map_data, remote_url) else: out = get_push_details(push_map_data, remote_url) assert isinstance(out, PushDetails) assert out.push_url == expected