mirror of
https://github.com/zulip/zulip.git
synced 2025-11-02 04:53:36 +00:00
webhooks/beeminder: Make deadline time (time_remain) positive.
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
"goal_type": "gainer",
|
||||
"autodata": null,
|
||||
"healthkitmetric": "",
|
||||
"losedate": 1515759100,
|
||||
"losedate": 1517759100,
|
||||
"deadline": -4500,
|
||||
"leadtime": 0,
|
||||
"alertstart": 81720,
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
"goal_type": "gainer",
|
||||
"autodata": null,
|
||||
"healthkitmetric": "",
|
||||
"losedate": 1515759100,
|
||||
"losedate": 1517759100,
|
||||
"deadline": -4500,
|
||||
"leadtime": 0,
|
||||
"alertstart": 81720,
|
||||
|
||||
@@ -3,7 +3,7 @@ import time as t
|
||||
from typing import Text
|
||||
from zerver.lib.test_classes import WebhookTestCase
|
||||
current_time = float(t.time())
|
||||
time = (float(1515759100) - current_time)/float(3600)
|
||||
time_delta_in_hours = (float(1517759100) - current_time)/float(3600)
|
||||
|
||||
class BeeminderHookTests(WebhookTestCase):
|
||||
STREAM_NAME = 'beeminder'
|
||||
@@ -12,7 +12,7 @@ class BeeminderHookTests(WebhookTestCase):
|
||||
def test_beeminder_derail(self) -> None:
|
||||
expected_subject = u"beekeeper"
|
||||
expected_message = u"Hello **aaron**! I am the Beeminder bot! :octopus: \n You are going to derail \
|
||||
from goal **gainweight** in **{:0.1f} hours** \n You need **+2 in 7 days (60)** to avoid derailing \n * Pledge: **0$** :relieved:".format(time)
|
||||
from goal **gainweight** in **{:0.1f} hours** \n You need **+2 in 7 days (60)** to avoid derailing \n * Pledge: **0$** :relieved:".format(time_delta_in_hours)
|
||||
self.send_and_test_stream_message('derail',
|
||||
expected_subject,
|
||||
expected_message,
|
||||
@@ -25,7 +25,7 @@ class BeeminderHookTests(WebhookTestCase):
|
||||
user_ip="127.0.0.1"
|
||||
)
|
||||
expected_message = u"I am the Beeminder bot! :octopus: \n You are going to derail from \
|
||||
goal **gainweight** in **{:0.1f} hours** \n You need **+2 in 7 days (60)** to avoid derailing \n * Pledge: **5$**:worried:".format(time)
|
||||
goal **gainweight** in **{:0.1f} hours** \n You need **+2 in 7 days (60)** to avoid derailing \n * Pledge: **5$**:worried:".format(time_delta_in_hours)
|
||||
self.send_and_test_private_message('derail_pm',
|
||||
expected_message,
|
||||
content_type="application/json")
|
||||
|
||||
Reference in New Issue
Block a user