Beispiel #1
0
def _mock_retrieve_content(mock, url):
    filename = urlparse(url).path
    _file = open('./templates%s' % filename, 'r')
    content = _file.read()
    _file.close()

    return content
Beispiel #2
0
def _mock_retreive_content(mock, url):
    filename = urlparse(url).path
    file = open('./templates%s' % filename, 'r')
    html = file.read()
    file.close()

    return html
Beispiel #3
0
def _mock_retreive_content(mock, url):
    filename = urlparse(url).path
    file = open('./templates%s' % filename, 'r')
    html = file.read()
    file.close()

    return html
Beispiel #4
0
    def _retreive_content(self, url):
        filename = urlparse(url).path
        file = open("./templates/%s" % filename, "r")
        html = file.read()
        file.close()

        return html
Beispiel #5
0
def _mock_retrieve_headers(mock, url):
    filename = urlparse(url).path

    headers = {
        'Content-Type':
        mimetypes.guess_type(filename)[0] or 'application/octet-stream'
    }

    return headers
Beispiel #6
0
def _mock_retrieve_headers(mock, url):
    filename = urlparse(url).path

    headers = {
        'Content-Type': mimetypes.guess_type(filename)[0] or 'application/octet-stream'
    }

    status_code = 200

    return headers, status_code
Beispiel #7
0
def _mock_retrieve_content(mock, url):
    if '.html' not in url:
        filename = '/generic/all_properties.html'
    else:
        filename = urlparse(url).path

    _file = open('./templates%s' % filename, 'r')
    content = _file.read()
    _file.close()

    status_code = 200

    return content, status_code
Beispiel #8
0
def _mock_retrieve_content(mock, url):
    if '.html' not in url:
        filename = '/generic/all_properties.html'
    else:
        filename = urlparse(url).path

    _file = open('./templates%s' % filename, 'r')
    content = _file.read()
    _file.close()

    status_code = 200

    return content, status_code
Beispiel #9
0
def _mock_retrieve_oembed_data(mock, url):
    if '.json' not in url:
        return {}, 404

    try:
        filename = urlparse(url).path
        _file = open('./json%s' % filename, 'r')
        content = _file.read()
        _file.close()

        status_code = 200
    except Exception as e:
        raise LassieError(e)

    return json.loads(content), status_code
Beispiel #10
0
def _mock_retrieve_oembed_data(mock, url):
    if '.json' not in url:
        return {}, 404

    try:
        filename = urlparse(url).path
        _file = open('./json%s' % filename, 'r')
        content = _file.read()
        _file.close()

        status_code = 200
    except Exception as e:
        raise LassieError(e)

    return json.loads(content), status_code