# Path: mangopay/utils.py
# def timestamp_from_date(date):
#     epoch = datetime.date(1970, 1, 1)
#     diff = date - epoch
#     return diff.days * 24 * 3600 + diff.seconds
# 
# Path: tests/settings.py
#     MANGOPAY_CLIENT_ID = 'sdk-unit-tests'
#     MANGOPAY_APIKEY = 'cqFfFrWfCcb7UadHNxx2C9Lo6Djw8ZduLi7J9USTmu8bhxxpju'
#     MANGOPAY_API_URL = 'https://api.mangopay.com/v2.01/'
#     MANGOPAY_API_SANDBOX_URL = 'https://api.sandbox.mangopay.com/v2.01/'
#     MANGOPAY_USE_SANDBOX = True
#     MANGOPAY_API_VERSION = 2
# MOCK_TESTS_RESPONSES = True


import json
import os
import re
import sys
import unittest
import responses
from datetime import datetime
from mangopay.utils import timestamp_from_date
from tests import settings
    with open(filepath, newline='', encoding='utf-8') as file:
        return file.read()


class RegisteredMocks(unittest.TestCase):

    def setUp(self):
        self.mock_oauth()

    def register_mock(self, data):
        match_querystring = False

        if 'match_querystring' in data:
            match_querystring = data['match_querystring'] or False

        if isinstance(data, list):
            for d in data:
                self.register_mock(d)
        else:
            if isinstance(data['body'], (dict, list)):
                data['body'] = json.dumps(data['body'])

            responses.add(data['method'], data['url'],
                          body=data['body'], status=data['status'],
                          content_type='application/json',
                          match_querystring=match_querystring)

    def mock_oauth(self):
        self.register_mock({
            'method': responses.POST,

# Path: mangopay/utils.py
# def timestamp_from_date(date):
#     epoch = datetime.date(1970, 1, 1)
#     diff = date - epoch
#     return diff.days * 24 * 3600 + diff.seconds
# 
# Path: tests/settings.py
#     MANGOPAY_CLIENT_ID = 'sdk-unit-tests'
#     MANGOPAY_APIKEY = 'cqFfFrWfCcb7UadHNxx2C9Lo6Djw8ZduLi7J9USTmu8bhxxpju'
#     MANGOPAY_API_URL = 'https://api.mangopay.com/v2.01/'
#     MANGOPAY_API_SANDBOX_URL = 'https://api.sandbox.mangopay.com/v2.01/'
#     MANGOPAY_USE_SANDBOX = True
#     MANGOPAY_API_VERSION = 2
# MOCK_TESTS_RESPONSES = True


# Path: tests/mocks.py
import json
import os
import re
import sys
import unittest
import responses
from datetime import datetime
from mangopay.utils import timestamp_from_date
from tests import settings

    with open(filepath, newline='', encoding='utf-8') as file:
        return file.read()


class RegisteredMocks(unittest.TestCase):

    def setUp(self):
        self.mock_oauth()

    def register_mock(self, data):
        match_querystring = False

        if 'match_querystring' in data:
            match_querystring = data['match_querystring'] or False

        if isinstance(data, list):
            for d in data:
                self.register_mock(d)
        else:
            if isinstance(data['body'], (dict, list)):
                data['body'] = json.dumps(data['body'])

            responses.add(data['method'], data['url'],
                          body=data['body'], status=data['status'],
                          content_type='application/json',
                          match_querystring=match_querystring)

    def mock_oauth(self):
        self.register_mock({
            'method': responses.POST,

            'url': settings.MANGOPAY_API_SANDBOX_URL + 'oauth/token',