Skip to content

Commit

Permalink
More testing of the hiding of the noisy link
Browse files Browse the repository at this point in the history
  • Loading branch information
thisismyrobot committed Jan 20, 2018
1 parent f7ccd92 commit 341aae3
Show file tree
Hide file tree
Showing 2 changed files with 83 additions and 3 deletions.
4 changes: 2 additions & 2 deletions dnstwister/templates/email/report.html
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ <h1>dnstwister report for <strong>{{ domain | domain_renderer }}</strong></h1>
</td>
</tr>{% endfor %}
</tbody>
</table>{% endif %}{% if noisy_link %}
<p>
</table>
{% endif %}{% if noisy_link %}<p>
These emails <strong>exclude</strong> domains considered to be "noisy" -
those that are either registered and unregistered constantly, or
constantly change IP address. <a href="{{ noisy_link }}">You can view a
Expand Down
82 changes: 81 additions & 1 deletion tests/test_tools_email.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,6 @@ def test_email_renderer_domain_sorting():
</tr>
</tbody>
</table>
<p>
These emails <strong>exclude</strong> domains considered to be "noisy" -
those that are either registered and unregistered constantly, or
Expand All @@ -175,3 +174,84 @@ def test_email_renderer_domain_sorting():
<a href="https://dnstwister.report/...">Unsubscribe</a>
</p>
""").strip()


def test_hiding_noisy_text_renderer():
"""Test the noisy text isn't shown if no noisy link."""
template = email_tools.render_email(
'report.html',
domain='www.example.com',
new=(('www.examp1e.com', '127.0.0.1', 'http://dnstwister.report/analyse/1234'),),
updated=(('www.exampl3.com', '127.0.0.1', '127.0.0.2', 'http://dnstwister.report/analyse/6789'),),
deleted=('www.examplle.com',),
unsubscribe_link='https://dnstwister.report/...',
noisy_link=None,
)

assert template.strip() == textwrap.dedent("""
<h1>dnstwister report for <strong>www<span>.</span>example<span>.</span>com</strong></h1>
<p>
<strong>NEW: dnstwister now supports Unicode domains.</strong>
</p>
<p>
<a href="https://dnstwister.report/...">Unsubscribe</a>
</p>
<h2>New registrations</h2>
<table>
<thead>
<tr>
<th>Registered Domain</th>
<th>Resolved IP</th>
<th>Tools</th>
</tr>
</thead>
<tbody>
<tr>
<td>
www<span>.</span>examp1e<span>.</span>com
</td>
<td>127.0.0.1</td>
<td><a href="http://dnstwister.report/analyse/1234">analyse</a></td>
</tr>
</tbody>
</table>
<h2>Updated registrations</h2>
<table>
<thead>
<tr>
<th>Registered Domain</th>
<th>Previously Resolved IP</th>
<th>Currently Resolved IP</th>
<th>Tools</th>
</tr>
</thead>
<tbody>
<tr>
<td>
www<span>.</span>exampl3<span>.</span>com
</td>
<td>127.0.0.1</td>
<td>127.0.0.2</td>
<td><a href="http://dnstwister.report/analyse/6789">analyse</a></td>
</tr>
</tbody>
</table>
<h2>Deleted registrations</h2>
<table>
<thead>
<tr>
<th>Previously Registered Domain</th>
</tr>
</thead>
<tbody>
<tr>
<td>
www<span>.</span>examplle<span>.</span>com
</td>
</tr>
</tbody>
</table>
<p>
<a href="https://dnstwister.report/...">Unsubscribe</a>
</p>
""").strip()

0 comments on commit 341aae3

Please sign in to comment.