Skip to content

Commit

Permalink
Integration tests for going back and overwriting decisions
Browse files Browse the repository at this point in the history
  • Loading branch information
cleborys committed Sep 7, 2018
1 parent 6e922b8 commit 2a6995c
Showing 1 changed file with 67 additions and 0 deletions.
67 changes: 67 additions & 0 deletions tests/core/audit_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,73 @@ def test_skip_decision(self, mock_printer):
'Saving progress...\n'
)

def test_go_back_and_change_yes_to_no(self, mock_printer):
modified_baseline = deepcopy(self.baseline)

values_to_inject = [None, False, True]
for secrets in modified_baseline['results'].values():
for secret in secrets:
value = values_to_inject.pop(0)
if value is not None:
secret['is_secret'] = value

self.run_logic(['s', 'y', 'b', 'n', 'y'], modified_baseline)

assert mock_printer.message == (
'Saving progress...\n'
)

def test_go_back_and_change_no_to_yes(self, mock_printer):
modified_baseline = deepcopy(self.baseline)

values_to_inject = [None, True, True]
for secrets in modified_baseline['results'].values():
for secret in secrets:
value = values_to_inject.pop(0)
if value is not None:
secret['is_secret'] = value

self.run_logic(['s', 'n', 'b', 'y', 'y'], modified_baseline)

assert mock_printer.message == (
'Saving progress...\n'
)

def test_go_back_and_change_yes_to_skip(self, mock_printer):
modified_baseline = deepcopy(self.baseline)

values_to_inject = [None, None, True]
for secrets in modified_baseline['results'].values():
for secret in secrets:
value = values_to_inject.pop(0)
if value is not None:
secret['is_secret'] = value

self.run_logic(['s', 'y', 'b', 's', 'y'], modified_baseline)

assert mock_printer.message == (
'Saving progress...\n'
)

def test_go_back_several_steps(self, mock_printer):
modified_baseline = deepcopy(self.baseline)

values_to_inject = [False, False, False]
for secrets in modified_baseline['results'].values():
for secret in secrets:
value = values_to_inject.pop(0)
if value is not None:
secret['is_secret'] = value

self.run_logic(
['s', 'y', 'b', 's', 'b', 'b', 'n', 'n', 'n'],
modified_baseline,
)

assert mock_printer.message == (
'Saving progress...\n'
)

def test_leapfrog_decision(self, mock_printer):
modified_baseline = deepcopy(self.leapfrog_baseline)
modified_baseline['results']['filenameA'][1]['is_secret'] = True
Expand Down

0 comments on commit 2a6995c

Please sign in to comment.