def create_data_source(url, name=None, id=None):
    data_source = mock.Mock()
    data_source.url = url
    if url.startswith("swift"):
        data_source.type = "swift"
        data_source.credentials = {'user': 'admin',
                                   'password': 'admin1'}
    elif url.startswith("hdfs"):
        data_source.type = "hdfs"
    if name is not None:
        data_source.name = name
    if id is not None:
        data_source.id = id
    return data_source
dataset/ETHPy150Open openstack/sahara/sahara/tests/unit/service/edp/edp_test_utils.py/create_data_source/original