Skip to content

Commit 6c6677c

Browse files
author
rootware
committed
separte file for unredact
1 parent 9ab215a commit 6c6677c

File tree

2 files changed

+18
-21
lines changed

2 files changed

+18
-21
lines changed

test/test_redact.py

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import pytest
22
from pyredactkit.redact import Redactor
3-
from pyredactkit.unredact import Unredactor
4-
from pyredactkit.identifiers import Identifier
53

64
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]
75
this is my IP: 102.23.5.1
@@ -44,27 +42,13 @@
4442
people_names = "John,Jones,Alex,Bruce"
4543
mask_names = "\u2588" * 15
4644
count_names = 4
47-
key_mapping = {
48-
"2b21e939-abc9-4d06-9c5a-de9bf2aa22b4": "10.10.10.1"}
49-
redacted_text = "My router is : 2b21e939-abc9-4d06-9c5a-de9bf2aa22b4"
50-
unredacted_text = "My router is : 10.10.10.1"
5145

5246

5347
@pytest.fixture
5448
def redactor_obj():
5549
return Redactor()
5650

5751

58-
@pytest.fixture
59-
def unredactor_obj():
60-
return Unredactor()
61-
62-
63-
@pytest.fixture
64-
def identifier_obj():
65-
return Identifier()
66-
67-
6852
def test_check_python_file(redactor_obj):
6953
assert redactor_obj.check_file_type(
7054
__file__) == 'text/x-python', 'Failed python file check'
@@ -88,8 +72,3 @@ def test_redact_name_function_should_return_string_and_integer(redactor_obj):
8872
set1 = (f'{mask_names},{mask_names},{mask_names},{mask_names}', count_names)
8973
assert redactor_obj.redact_name(
9074
people_names) == set1, 'redact_name function should return masked data and count'
91-
92-
93-
def test_replace_all_function_should_return_unredacted_string(unredactor_obj):
94-
assert unredactor_obj.replace_all(
95-
redacted_text, key_mapping) == unredacted_text, 'replace_all function should return unredacted string'

test/test_unredact.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import pytest
2+
from pyredactkit.unredact import Unredactor
3+
from pyredactkit.identifiers import Identifier
4+
5+
key_mapping = {
6+
"2b21e939-abc9-4d06-9c5a-de9bf2aa22b4": "10.10.10.1"}
7+
redacted_text = "My router is : 2b21e939-abc9-4d06-9c5a-de9bf2aa22b4"
8+
unredacted_text = "My router is : 10.10.10.1"
9+
10+
11+
@pytest.fixture
12+
def unredactor_obj():
13+
return Unredactor()
14+
15+
16+
def test_replace_all_function_should_return_unredacted_string(unredactor_obj):
17+
assert unredactor_obj.replace_all(
18+
redacted_text, key_mapping) == unredacted_text, 'replace_all function should return unredacted string'

0 commit comments

Comments
 (0)