def test_no_write_if_not_fuzzed(self): with Fuzzer(*self.args) as f: self.assertFalse(os.path.exists(f.output_file_path), f.output_file_path) # if we haven't fuzzed, don't write f.fuzzed = None f.write_fuzzed() self.assertFalse(os.path.exists(f.output_file_path))
def test_write_fuzzed(self): with Fuzzer(*self.args) as f: self.assertFalse(os.path.exists(f.output_file_path), f.output_file_path) # if we have fuzzed, write f.fuzzed = 'abcd' f.write_fuzzed() self.assertTrue(os.path.exists(f.output_file_path)) self.assertEqual(os.path.getsize(f.output_file_path), len(f.fuzzed)) with open(f.output_file_path, 'rb') as fd: written = fd.read() self.assertEqual(written, f.fuzzed)
def test_read_input(self): with Fuzzer(*self.args) as f: self.assertEqual(f.input, self.sf.read())
def test_minimizable_attribute(self): yes = MinimizableFuzzer(*self.args) self.assertTrue(yes.is_minimizable) no = Fuzzer(*self.args) self.assertFalse(no.is_minimizable)