Exemple #1
0
def change_make_timestamp(datetimeobject):
    if isinstance(datetimeobject, datetime.datetime) or isinstance(datetimeobject, datetime.date):
        return timestamp_from_date(datetimeobject)
    elif isinstance(datetimeobject, int):
        return datetimeobject
    else:
        raise TypeError
from datetime import datetime

import json
import time
import sys
import re
import os

import responses

from tests import settings

from mangopay.utils import timestamp_from_date

today = datetime.utcnow().date()
today_timestamp = timestamp_from_date(today)


def get_fixture(name):
    path = os.path.abspath(__file__)
    fixtures_path = os.path.join(os.path.dirname(path), 'fixtures')
    filepath = os.path.join(fixtures_path, '%s.json' % name)

    if sys.version_info < (3, 0):
        with open(filepath, 'r') as file:
            return file.read()

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

Exemple #3
0
def _make_timestamp(data):
    if isinstance(data, datetime.date):
        return timestamp_from_date(data)
Exemple #4
0
 def _update_user(date):
     return timestamp_from_date(date)