-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a test that will always run first to test the auto-sync that happ…
…ens on module import
- Loading branch information
1 parent
6334a34
commit c337e7a
Showing
2 changed files
with
30 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import yaml | ||
import cronitor | ||
import unittest | ||
from unittest.mock import call, patch, ANY | ||
import time | ||
import cronitor | ||
|
||
FAKE_API_KEY = 'cb54ac4fd16142469f2d84fc1bbebd84XXXDEADXXX' | ||
YAML_PATH = './cronitor/tests/cronitor.yaml' | ||
|
||
cronitor.api_key = FAKE_API_KEY | ||
cronitor.timeout = 10 | ||
|
||
class SyncTests(unittest.TestCase): | ||
|
||
def setUp(self): | ||
return super().setUp() | ||
|
||
def test_00_monitor_attributes_are_put(self): | ||
# This test will run first, test that attributes are synced correctly, and then undo the global mock | ||
|
||
with patch('cronitor.Monitor.put') as mock_put: | ||
time.sleep(2) | ||
calls = [call([{'key': 'ping-decorator-test', 'name': 'Ping Decorator Test'}])] | ||
mock_put.assert_has_calls(calls) | ||
|
||
@cronitor.job('ping-decorator-test', attributes={'name': 'Ping Decorator Test'}) | ||
def function_call_with_attributes(self): | ||
return |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters