import json


def mock_requests_get(*args, **kwargs):
    """ Mock requests.get() function for testing meme parsing functions.
    """
    class MockResponse(object):

        def __init__(self, json_data, status_code):
            self.json_data = json_data
            self.status_code = status_code

        def json(self):

            return self.json_data

    url = args[0]
    target_url = "http://version1.api.memegenerator.net/" \
                 "Instances_Select_ByPopular"

    with open('./test/memegenerator_sample.json') as data_file:
        mock_json_1 = json.load(data_file)

    if url == target_url:
        return MockResponse(mock_json_1, 200)
    else:
        return MockResponse('This is a mocking function.', 200)