INFRA-140 test prototypes

This commit is contained in:
anastasia prasolova 2020-04-30 16:14:32 +03:00
parent 10d0d540d7
commit 25810a756d
6 changed files with 121 additions and 0 deletions

View file

@ -0,0 +1,21 @@
#!/usr/bin/python3
"""
A file with specific assertions that Robot Framework
doesn't have in its builtins.
"""
from robot.api.deco import keyword
from robot.utils.asserts import assert_equal
@keyword('Should Be Equal as Binaries')
def sbe_as_binaries(fst: str, snd: str):
"""
Assertion to compare binary contents of
two files. Parameters:
- `fst`: path to first file
- `snd`: path to second file
"""
fst_fd, snd_fd = open(fst, 'rb'), open(snd, 'rb')
fst_bytes, snd_bytes = fst_fd.read(), snd_fd.read()
assert_equal(fst_bytes, snd_bytes, msg='Given files are not equal as binaries')