refactor to satisfy flak8

This commit is contained in:
scito 2022-09-03 16:12:28 +02:00 committed by Roland Kurmann
parent 7f8250c0a6
commit 175e7c38e5
5 changed files with 37 additions and 8 deletions

View file

@ -24,6 +24,7 @@ import os
import extract_otp_secret_keys
def test_extract_csv():
# Arrange
cleanup()
@ -35,11 +36,12 @@ def test_extract_csv():
expected_csv = read_csv('example_output.csv')
actual_csv = read_csv('test_example_output.csv')
assert actual_csv == actual_csv
assert actual_csv == expected_csv
# Clean up
cleanup()
def test_extract_json():
# Arrange
cleanup()
@ -55,13 +57,16 @@ def test_extract_json():
# Clean up
cleanup()
def cleanup():
remove_file('test_example_output.csv')
remove_file('test_example_output.json')
def remove_file(filename):
if os.path.exists(filename): os.remove(filename)
def read_csv(filename):
"""Returns a list of lines."""
with open(filename, "r") as infile:
@ -71,6 +76,7 @@ def read_csv(filename):
lines.append(line)
return lines
def read_json(filename):
"""Returns a list or a dictionary."""
with open(filename, "r") as infile: