|
1 | 1 | import pytest |
2 | 2 | import os |
| 3 | +import json |
3 | 4 | from pyredactkit.custom_redactor import CustomRedactorEngine |
4 | 5 | data = """John, please get that article on www.linkedin.com to me by 5:00PM on Jan 9th 2012. 4:00 would be ideal, actually. If you have any questions, You can reach me at(519)-236-2723 or get in touch with my associate at [email protected] |
5 | 6 | this is my IP: 102.23.5.1 |
@@ -51,18 +52,13 @@ def custom_redactor(): |
51 | 52 |
|
52 | 53 |
|
53 | 54 | @pytest.fixture |
54 | | -def mocker_text_file(mocker): |
55 | | - content = "Message to write on file to be written" |
| 55 | +def mocker_json_file(mocker): |
| 56 | + content = {"key": "value"} |
56 | 57 | mocked_open = mocker.mock_open(read_data=content) |
57 | 58 | builtin_open = "builtins.open" |
58 | 59 | mocker.patch(builtin_open, mocked_open) |
59 | 60 |
|
60 | | - |
61 | | -# def test_write_hashmap_should_create_json_file(custom_redactor, tmp_path): |
62 | | -# hash_map = {"key": "value"} |
63 | | -# custom_redactor.write_hashmap(hash_map, filename='fakefile', savedir=tmp_path) |
64 | | - |
65 | | -# def test_redact_custom_function_should_return_string_and_dictionary(custom_redactor): |
| 61 | +# def test_redact_custom_function_should_return_string_and_dictionary(custom_redactor,mocker_json_file): |
66 | 62 | # set1 = custom_redactor.redact_custom(data) |
67 | 63 | # set2 = ("This is a string", hash_table) |
68 | 64 | # assert isinstance(type(set1[0]), str), "1st element of redact_custom function should return string" |
|
0 commit comments