def test_runtime_error_raised_if_no_coder_provided(self, sysargv_no_coder_mock): with pytest.raises(RuntimeError) as error: main() assert 'No coder provided.' in error.value.args
def test_runtime_error_raised_if_no_key_provided(self, sysargv_no_key_mock): with pytest.raises(RuntimeError) as error: main() assert 'No key nor key_vector provided.' in error.value.args
def test_string_is_cesar_encoded_except_for_header_to_console( self, sysargv_headed_input_mock, capsys): main() out, _ = capsys.readouterr() assert out == "aaa\nbbb"
def test_file_is_cesar_with_char_keys_encoded_to_console( self, sysargv_in_file_mock, capsys): main() out, _ = capsys.readouterr() assert out == "ceg"
def test_console_input_is_cesar_encoded_to_console( self, sysargv_in_out_consoles_mock, capsys): main() out, _ = capsys.readouterr() assert out == "def"
def test_string_is_cesar_with_keys_list_encoded_to_console( self, sysargv_int_keys_list_mock, capsys): main() out, _ = capsys.readouterr() assert out == "uijt!xpslt"
def test_string_is_cesar_with_char_keys_encoded_to_file( self, sysargv_out_file_mock): main() calls = [call('c'), call('e'), call('g')] self.open_mock.return_value.write.assert_has_calls(calls) self.open_mock.return_value.close.assert_called_once()