Showing
2 changed files
with
13 additions
and
6 deletions
@@ -185,15 +185,22 @@ Get Broker Property By Username | @@ -185,15 +185,22 @@ Get Broker Property By Username | ||
185 | Звірити дату тендера із значенням | 185 | Звірити дату тендера із значенням |
186 | [Arguments] ${username} ${left} ${field} | 186 | [Arguments] ${username} ${left} ${field} |
187 | ${right}= Викликати для учасника ${username} Отримати інформацію із тендера ${field} | 187 | ${right}= Викликати для учасника ${username} Отримати інформацію із тендера ${field} |
188 | - Звірити дату ${left} ${right} | 188 | + Порівняти дати ${left} ${right} |
189 | Set_To_Object ${USERS.users['${username}'].tender_data.data} ${field} ${left} | 189 | Set_To_Object ${USERS.users['${username}'].tender_data.data} ${field} ${left} |
190 | 190 | ||
191 | 191 | ||
192 | -Звірити дату | ||
193 | - [Arguments] ${left} ${right} | 192 | +Порівняти дати |
193 | + [Documentation] | ||
194 | + ... Compare dates with specified ``accuracy`` (in seconds). | ||
195 | + ... Default is `60`. | ||
196 | + ... | ||
197 | + ... The keyword will fail if the difference between | ||
198 | + ... ``left`` and ``right`` dates is more than ``accuracy``, | ||
199 | + ... otherwise it will pass. | ||
200 | + [Arguments] ${left} ${right} ${accuracy}=60 | ||
194 | Should Not Be Equal ${left} ${None} | 201 | Should Not Be Equal ${left} ${None} |
195 | Should Not Be Equal ${right} ${None} | 202 | Should Not Be Equal ${right} ${None} |
196 | - ${status}= compare_date ${left} ${right} | 203 | + ${status}= compare_date ${left} ${right} ${accuracy} |
197 | Should Be True ${status} | 204 | Should Be True ${status} |
198 | 205 | ||
199 | 206 |
@@ -47,7 +47,7 @@ def change_state(arguments): | @@ -47,7 +47,7 @@ def change_state(arguments): | ||
47 | return "pass" | 47 | return "pass" |
48 | 48 | ||
49 | 49 | ||
50 | -def compare_date(date1, date2): | 50 | +def compare_date(date1, date2, accuracy): |
51 | date1 = parse(date1) | 51 | date1 = parse(date1) |
52 | date2 = parse(date2) | 52 | date2 = parse(date2) |
53 | if date1.tzinfo is None: | 53 | if date1.tzinfo is None: |
@@ -56,7 +56,7 @@ def compare_date(date1, date2): | @@ -56,7 +56,7 @@ def compare_date(date1, date2): | ||
56 | date2 = TZ.localize(date2) | 56 | date2 = TZ.localize(date2) |
57 | 57 | ||
58 | delta = (date1 - date2).total_seconds() | 58 | delta = (date1 - date2).total_seconds() |
59 | - if abs(delta) > 60: | 59 | + if abs(delta) > accuracy: |
60 | return False | 60 | return False |
61 | return True | 61 | return True |
62 | 62 |
Please
register
or
login
to post a comment