2016-08-23 22:47:13 -04:00
|
|
|
from unittest import TestCase
|
|
|
|
from datetime import datetime
|
|
|
|
|
2016-08-24 07:09:43 -04:00
|
|
|
from metrik.batch import flows, build_cron_file
|
2016-08-23 22:47:13 -04:00
|
|
|
|
|
|
|
|
|
|
|
class BatchTest(TestCase):
|
|
|
|
def test_flows_return_schedule(self):
|
|
|
|
present = datetime.now()
|
|
|
|
live = False
|
|
|
|
for flow_name, flow_class in flows.items():
|
|
|
|
assert flow_class(present=present,
|
|
|
|
live=live).get_schedule() is not None
|
2016-08-24 07:09:43 -04:00
|
|
|
|
|
|
|
def test_cron_string(self):
|
|
|
|
cron_string = build_cron_file()
|
|
|
|
assert len(cron_string.split('\n')) == len(flows) + 1
|
|
|
|
assert cron_string[-1] == '\n'
|