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.test import BaseTestCase
|
||||||
from hc.accounts.models import Profile
|
from hc.accounts.models import Profile
|
||||||
|
from hc.api.models import Check
|
||||||
|
|
||||||
|
|
||||||
class LoginTestCase(BaseTestCase):
|
class LoginTestCase(BaseTestCase):
|
||||||
@ -41,3 +42,17 @@ class LoginTestCase(BaseTestCase):
|
|||||||
|
|
||||||
profile = Profile.objects.for_user(self.alice)
|
profile = Profile.objects.for_user(self.alice)
|
||||||
self.assertEqual(profile.api_key, "")
|
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):
|
def url(self):
|
||||||
return settings.PING_ENDPOINT + str(self.code)
|
return settings.PING_ENDPOINT + str(self.code)
|
||||||
|
|
||||||
|
def log_url(self):
|
||||||
|
return settings.SITE_ROOT + reverse("hc-log", args=[self.code])
|
||||||
|
|
||||||
def email(self):
|
def email(self):
|
||||||
return "%s@%s" % (self.code, settings.PING_EMAIL_DOMAIN)
|
return "%s@%s" % (self.code, settings.PING_EMAIL_DOMAIN)
|
||||||
|
|
||||||
|
@ -41,9 +41,9 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<th></th>
|
<th></th>
|
||||||
<th>Name</th>
|
<th>Name</th>
|
||||||
<th>URL</th>
|
|
||||||
<th>Period</th>
|
<th>Period</th>
|
||||||
<th>Last Ping</th>
|
<th>Last Ping</th>
|
||||||
|
<th>Actions</th>
|
||||||
</tr>
|
</tr>
|
||||||
{% for check in checks %}
|
{% for check in checks %}
|
||||||
<tr>
|
<tr>
|
||||||
@ -71,9 +71,6 @@
|
|||||||
<small>{{ check.tags }}</small>
|
<small>{{ check.tags }}</small>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
<td class="url-cell">
|
|
||||||
<code>{{ check.url }}</code>
|
|
||||||
</td>
|
|
||||||
<td>
|
<td>
|
||||||
{{ check.timeout|hc_duration }}
|
{{ check.timeout|hc_duration }}
|
||||||
</td>
|
</td>
|
||||||
@ -84,6 +81,9 @@
|
|||||||
Never
|
Never
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
|
<td>
|
||||||
|
<a href="{{ check.log_url }}">View Log</a>
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</table>
|
</table>
|
||||||
|
@ -39,7 +39,6 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<th></th>
|
<th></th>
|
||||||
<th>Name</th>
|
<th>Name</th>
|
||||||
<th>URL</th>
|
|
||||||
<th>Period</th>
|
<th>Period</th>
|
||||||
<th>Last Ping</th>
|
<th>Last Ping</th>
|
||||||
</tr>
|
</tr>
|
||||||
@ -69,9 +68,6 @@
|
|||||||
<small>{{ check.tags }}</small>
|
<small>{{ check.tags }}</small>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
<td class="url-cell">
|
|
||||||
<code>{{ check.url }}</code>
|
|
||||||
</td>
|
|
||||||
<td>
|
<td>
|
||||||
{{ check.timeout|hc_duration }}
|
{{ check.timeout|hc_duration }}
|
||||||
</td>
|
</td>
|
||||||
@ -82,6 +78,9 @@
|
|||||||
Never
|
Never
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
|
<td>
|
||||||
|
<a href="{{ check.log_url }}">View Log</a>
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</table>
|
</table>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user