Commit 3f323c260ac44ccdbcc706f2e44f311b7eb8fe2c

Authored by Andrew Yanovych
1 parent 1ea9bd8a

added method for comparing time in different formats

@@ -2,6 +2,7 @@ @@ -2,6 +2,7 @@
2 import os 2 import os
3 from munch import munchify, Munch, fromYAML 3 from munch import munchify, Munch, fromYAML
4 from json import load 4 from json import load
  5 +from iso8601 import parse_date
5 from robot.output import LOGGER 6 from robot.output import LOGGER
6 from robot.output.loggerhelper import Message 7 from robot.output.loggerhelper import Message
7 from robot.libraries.BuiltIn import BuiltIn 8 from robot.libraries.BuiltIn import BuiltIn
@@ -11,12 +12,20 @@ from dateutil.parser import parse @@ -11,12 +12,20 @@ from dateutil.parser import parse
11 from dateutil.tz import tzlocal 12 from dateutil.tz import tzlocal
12 from dpath.util import set as xpathset 13 from dpath.util import set as xpathset
13 from jsonpath_rw import parse as parse_path 14 from jsonpath_rw import parse as parse_path
  15 +import time
14 from .initial_data import ( 16 from .initial_data import (
15 test_tender_data, test_question_data, test_question_answer_data, 17 test_tender_data, test_question_data, test_question_answer_data,
16 test_bid_data, test_award_data, test_complaint_data, test_complaint_reply_data, test_tender_data_multiple_lots, 18 test_bid_data, test_award_data, test_complaint_data, test_complaint_reply_data, test_tender_data_multiple_lots,
17 auction_bid 19 auction_bid
18 ) 20 )
19 - 21 +def compare_date (isodate, broker_date):
  22 + iso_dt=parse_date(isodate)
  23 + br_dt=datetime.strptime(broker_date, "%d-%m-%Y, %H:%M")
  24 + br_dt_tz=br_dt.replace(tzinfo = iso_dt.tzinfo)
  25 + delta = (iso_dt-br_dt_tz).total_seconds()
  26 + if delta > 60:
  27 + return False
  28 + return True
20 29
21 def log_object_data(data, file_name="", format="yaml"): 30 def log_object_data(data, file_name="", format="yaml"):
22 if not isinstance(data, Munch): 31 if not isinstance(data, Munch):
Please register or login to post a comment