[7fc5df]: / tests / surrogates / generators / test_url.py

Download this file

28 lines (22 with data), 750 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
from deidentify.surrogates.generators import URLSurrogates
from .util import RandomDataMock
def test_replace_all():
annotations = [
'www.abc.com/123-abc-6yz',
'https://abc.com/123-abc-6yz',
'http://abc.com/123-abc-6yz',
'http://www.abc.com/123-abc-6yz',
'http://abc.nl/123-abc-6yz',
'abc.nl',
'www.abc.nl',
]
url_surrogates = URLSurrogates(annotations=annotations, random_data=RandomDataMock())
assert url_surrogates.replace_all() == [
'www.ccc.com/111-ccc-1cc',
'https://ccc.com/111-ccc-1cc',
'http://ccc.com/111-ccc-1cc',
'http://www.ccc.com/111-ccc-1cc',
'http://ccc.nl/111-ccc-1cc',
'ccc.nl',
'www.ccc.nl',
]