Initial commit to photo-dater with pytest test
This commit is contained in:
25
pytest/helpers.py
Normal file
25
pytest/helpers.py
Normal file
@@ -0,0 +1,25 @@
|
||||
import random
|
||||
import string
|
||||
import subprocess
|
||||
|
||||
def run_successfull_cmd(command):
|
||||
command = command.split()
|
||||
output = subprocess.run(command, capture_output=True, encoding='UTF-8')
|
||||
assert output.returncode == 0
|
||||
return output.stdout
|
||||
|
||||
def gen_rand_name(max_name_len):
|
||||
name_len = random.randint(3, max_name_len)
|
||||
return ''.join(random.choice(string.ascii_letters) for x in range(name_len))
|
||||
|
||||
def check_log_string(log_file, search_str):
|
||||
lines = ''
|
||||
with open(log_file, 'r') as my_log:
|
||||
lines = my_log.readlines()
|
||||
for line in lines:
|
||||
if search_str in line:
|
||||
return True
|
||||
|
||||
print(lines)
|
||||
return False
|
||||
|
||||
Reference in New Issue
Block a user