Skip to content

Commit

Permalink
fix test in order to select the last report file
Browse files Browse the repository at this point in the history
  • Loading branch information
KissPeter committed Mar 4, 2020
1 parent 88993e2 commit ae60cc6
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions test/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import os
import tempfile

import pytest
import requests

from fuzzer import Fuzzer
Expand Down Expand Up @@ -66,9 +65,10 @@ def fuzz(self, api_resources):
prog.run()

def get_last_report_file(self):
self.report_files = os.listdir(self.report_dir)
with open("{}/{}".format(self.report_dir, self.report_files[0]), mode='r', encoding='utf-8') as f:
return json.loads(f.read())
os.chdir(self.report_dir)
self.report_files = sorted(filter(os.path.isfile, os.listdir('.')), key=os.path.getmtime)
with open("{}/{}".format(self.report_dir, self.report_files[-1]), mode='r', encoding='utf-8') as f:
return json.load(f)

def fuzz_and_get_last_call(self, api_path, api_def):
self.swagger.pop('paths')
Expand Down

0 comments on commit ae60cc6

Please sign in to comment.