tests: adapt to wcs switch to timestamptz (#86887)
gitea/wcs-olap/pipeline/head This commit looks good
Details
gitea/wcs-olap/pipeline/head This commit looks good
Details
This commit is contained in:
parent
694e4044d2
commit
d9609f739e
|
@ -88,6 +88,7 @@ account.store()
|
|||
import datetime
|
||||
import random
|
||||
from quixote import get_publisher
|
||||
from django.utils.timezone import make_aware
|
||||
|
||||
from wcs.categories import Category
|
||||
from wcs.formdef import FormDef
|
||||
|
@ -140,7 +141,7 @@ agent.store()
|
|||
for i in range(50):
|
||||
formdata = formdef.data_class()()
|
||||
formdata.just_created()
|
||||
formdata.receipt_time = datetime.datetime(2018, random.randrange(1, 13), random.randrange(1, 29)).timetuple()
|
||||
formdata.receipt_time = make_aware(datetime.datetime(2018, random.randrange(1, 13), random.randrange(1, 29)))
|
||||
formdata.data = {'1': 'FOO BAR é %d' % i}
|
||||
if i%4 == 0:
|
||||
formdata.data['2'] = 'foo'
|
||||
|
|
|
@ -24,6 +24,7 @@ import httmock
|
|||
import pytest
|
||||
import requests
|
||||
import utils
|
||||
from django.utils.timezone import make_aware
|
||||
from psycopg2.extensions import ISOLATION_LEVEL_AUTOCOMMIT
|
||||
|
||||
|
||||
|
@ -251,6 +252,7 @@ def test_dimension_stability(wcs, wcs_dir, postgres_db, tmpdir, olap_cmd, caplog
|
|||
script = """
|
||||
import datetime
|
||||
import random
|
||||
from django.utils.timezone import make_aware
|
||||
from quixote import get_publisher
|
||||
from wcs.formdef import FormDef
|
||||
formdef = FormDef.get_by_urlname('demande')
|
||||
|
@ -267,7 +269,7 @@ user = get_publisher().user_class.select()[0]
|
|||
|
||||
formdata = formdef.data_class()()
|
||||
formdata.just_created()
|
||||
formdata.receipt_time = datetime.datetime(2018, random.randrange(1, 13), random.randrange(1, 29)).timetuple()
|
||||
formdata.receipt_time = make_aware(datetime.datetime(2018, random.randrange(1, 13), random.randrange(1, 29)))
|
||||
formdata.data = {'1': 'FOO BAR 1'}
|
||||
formdata.data['2'] = 'bazouka'
|
||||
formdata.data['2_display'] = 'bazouka'
|
||||
|
|
|
@ -101,7 +101,7 @@ class Evolution(BaseObject):
|
|||
|
||||
def __init__(self, wcs_api, **kwargs):
|
||||
super().__init__(wcs_api, **kwargs)
|
||||
self.time = isodate.parse_datetime(self.time)
|
||||
self.time = isodate.parse_datetime(self.time[:19]) # skip microseconds and timezone
|
||||
self.parts = [BaseObject(wcs_api, **part) for part in self.parts or []]
|
||||
self.who = EvolutionUser(wcs_api, **self.who) if self.who else None
|
||||
|
||||
|
|
Loading…
Reference in New Issue