forked from GithubBackups/healthchecks
Email alerts and monthly reports have links to Log pages.
Don't show ping URLs -- gmail converts them to clickable links, and people click on them.
This commit is contained in:
parent
24e370cb72
commit
da613963e9
@ -2,6 +2,7 @@ from django.core import mail
|
||||
|
||||
from hc.test import BaseTestCase
|
||||
from hc.accounts.models import Profile
|
||||
from hc.api.models import Check
|
||||
|
||||
|
||||
class LoginTestCase(BaseTestCase):
|
||||
@ -41,3 +42,17 @@ class LoginTestCase(BaseTestCase):
|
||||
|
||||
profile = Profile.objects.for_user(self.alice)
|
||||
self.assertEqual(profile.api_key, "")
|
||||
|
||||
def test_it_sends_report(self):
|
||||
check = Check(name="Test Check", user=self.alice)
|
||||
check.save()
|
||||
|
||||
profile = Profile.objects.for_user(self.alice)
|
||||
profile.send_report()
|
||||
|
||||
# And an email should have been sent
|
||||
self.assertEqual(len(mail.outbox), 1)
|
||||
message = mail.outbox[0]
|
||||
|
||||
self.assertEqual(message.subject, 'Monthly Report')
|
||||
self.assertIn("Test Check", message.body)
|
||||
|
@ -61,6 +61,9 @@ class Check(models.Model):
|
||||
def url(self):
|
||||
return settings.PING_ENDPOINT + str(self.code)
|
||||
|
||||
def log_url(self):
|
||||
return settings.SITE_ROOT + reverse("hc-log", args=[self.code])
|
||||
|
||||
def email(self):
|
||||
return "%s@%s" % (self.code, settings.PING_EMAIL_DOMAIN)
|
||||
|
||||
|
@ -41,9 +41,9 @@
|
||||
<tr>
|
||||
<th></th>
|
||||
<th>Name</th>
|
||||
<th>URL</th>
|
||||
<th>Period</th>
|
||||
<th>Last Ping</th>
|
||||
<th>Actions</th>
|
||||
</tr>
|
||||
{% for check in checks %}
|
||||
<tr>
|
||||
@ -71,9 +71,6 @@
|
||||
<small>{{ check.tags }}</small>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td class="url-cell">
|
||||
<code>{{ check.url }}</code>
|
||||
</td>
|
||||
<td>
|
||||
{{ check.timeout|hc_duration }}
|
||||
</td>
|
||||
@ -84,6 +81,9 @@
|
||||
Never
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>
|
||||
<a href="{{ check.log_url }}">View Log</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
|
@ -39,7 +39,6 @@
|
||||
<tr>
|
||||
<th></th>
|
||||
<th>Name</th>
|
||||
<th>URL</th>
|
||||
<th>Period</th>
|
||||
<th>Last Ping</th>
|
||||
</tr>
|
||||
@ -69,9 +68,6 @@
|
||||
<small>{{ check.tags }}</small>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td class="url-cell">
|
||||
<code>{{ check.url }}</code>
|
||||
</td>
|
||||
<td>
|
||||
{{ check.timeout|hc_duration }}
|
||||
</td>
|
||||
@ -82,6 +78,9 @@
|
||||
Never
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>
|
||||
<a href="{{ check.log_url }}">View Log</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
|
Loading…
x
Reference in New Issue
Block a user