Commit 853234bcdfe523ee5862bbf76e5d648999792e64

Authored by Volodymyr Cherepanyak
1 parent 03026108

tests timezone fixed

1 1 # -*- coding: utf-8 -
  2 +import os
  3 +from pytz import timezone
2 4 from datetime import datetime, timedelta
3   -now = datetime.now()
4 5 from munch import munchify
5 6 from faker import Factory
  7 +from tempfile import NamedTemporaryFile
  8 +
6 9 fake = Factory.create('uk_UA')
7 10 fake_ru = Factory.create('ru')
8 11 fake_en = Factory.create()
9   -from tempfile import NamedTemporaryFile
  12 +
  13 +TZ = timezone(os.environ['TZ'] if 'TZ' in os.environ else 'Europe/Kiev')
  14 +
  15 +def get_now():
  16 + return datetime.now(TZ)
  17 +
10 18
11 19 def create_fake_doc():
12 20 content = fake.text()
... ... @@ -16,7 +24,7 @@ def create_fake_doc():
16 24 return tf.name
17 25
18 26 def test_tender_data(period_interval=2):
19   - now = datetime.now()
  27 + now = get_now()
20 28 return {
21 29 "title": u"[ТЕСТУВАННЯ] " + fake.catch_phrase(),
22 30 "mode": "test",
... ... @@ -100,7 +108,7 @@ def test_tender_data(period_interval=2):
100 108 }
101 109
102 110 def prom_test_tender_data():
103   - now = datetime.now()
  111 + now = get_now()
104 112 return {
105 113 "title": fake.catch_phrase(),
106 114 "mode": "test",
... ... @@ -185,7 +193,7 @@ def prom_test_tender_data():
185 193 }
186 194
187 195 def test_tender_data_multiple_lots(period_interval=2):
188   - now = datetime.now()
  196 + now = get_now()
189 197 return {
190 198 "title": fake.catch_phrase(),
191 199 "mode": "test",
... ...
Please register or login to post a comment