# Path: kibitzr/conf.py
# class ReloadableSettings(object):
# class CompositeCreds(object):
# class PlainYamlCreds(object):
# class SettingsParser(object):
#     CONFIG_DIRS = (
#         '',
#         '~/.config/kibitzr/',
#         '~/',
#     )
#     CONFIG_FILENAME = 'kibitzr.yml'
#     RE_PUNCTUATION = re.compile(r'\W+')
#     UNNAMED_PATTERN = 'Unnamed check {0}'
#     CREDENTIALS_FILENAME = 'kibitzr-creds.yml'
#     RE_PUNCTUATION = re.compile(r'\W+')
#     UNNAMED_PATTERN = 'Unnamed check {0}'
#     def __init__(self, config_dir):
#     def detect_config_dir(cls):
#     def instance(cls):
#     def reread(self):
#     def read_conf(self):
#     def open_conf(self):
#     def __init__(self, config_dir):
#     def reread(self):
#     def load_extensions(self):
#     def get(self, key, default=None):
#     def __getitem__(self, key):
#     def __init__(self, config_dir):
#     def __contains__(self, key):
#     def __getitem__(self, key):
#     def reread(self):
#     def open_creds(self):
# def settings():
#     def parse_checks(self, conf):
#     def inject_notifiers(check, notifiers):
#     def inject_scenarios(check, scenarios):
#     def expand_schedule(check):
#     def unpack_batches(checks):
#     def inject_missing_names(cls, checks):
#     def url_to_name(cls, url):
#     def unpack_templates(checks, templates):
# 
# Path: kibitzr/timeline.py
# class Timeline(object):
#     RE_TIME = re.compile(r'\d?\d:\d\d')
#     def __init__(self, scheduler=None):
#     def parse_check(cls, check):
#     def _clean_single_schedule(cls, check, schedule_dict):
#     def _clean_unit(check, unit):
#     def _clean_at(cls, check, at):
#     def schedule_checks(self, checkers):
# def parse_check(check):
# def run_pending():
# def schedule_checks(checkers):
# 
# Path: tests/compat.py

# 
# Path: tests/unit/helpers.py
# @contextlib.contextmanager
# def patch_conf(data):
#     with patch_source(ReloadableSettings, 'open_conf', data) as fake_method:
#         yield fake_method
# 
# @contextlib.contextmanager
# def patch_creds(data):
#     with patch_source(PlainYamlCreds, 'open_creds', data) as fake_method:
#         yield fake_method


import pytest
from kibitzr.conf import (
    settings,
    ReloadableSettings,
    ConfigurationError,
)
from kibitzr.timeline import TimelineRule
from ..compat import mock
from .helpers import patch_conf, patch_creds
        'url': "https://www.worldtimeserver.com/current_time_in_US-NY.aspx",
        'transform': [{'css': 'span#theTime'}, 'text'],
        'notify': [{'python': 'print(content)'}],
        'schedule': [TimelineRule(interval=1, unit='day', at='20:30')]
    },
    {
        'name': 'Crazy scheduling alarm',
        'url': "https://www.worldtimeserver.com/current_time_in_US-NY.aspx",
        'transform': [{'css': 'span#theTime'}, 'text'],
        'notify': [{'python': 'print(content)'}],
        'schedule': [
            TimelineRule(interval=1, unit='days', at='15:30'),
            TimelineRule(interval=1, unit='hour', at=None),
            TimelineRule(interval=4, unit='minutes', at=None),
            TimelineRule(interval=1, unit='saturday', at='11:17')
        ]
    },
]

creds = {
    'mailgun': {'url': 'ZZZ'},
}

notifiers = {
    'slack': {'url': 'XXX'},
}


def test_complex_conf_sample():
    with patch_conf(sample_conf):

# Path: kibitzr/conf.py
# class ReloadableSettings(object):
# class CompositeCreds(object):
# class PlainYamlCreds(object):
# class SettingsParser(object):
#     CONFIG_DIRS = (
#         '',
#         '~/.config/kibitzr/',
#         '~/',
#     )
#     CONFIG_FILENAME = 'kibitzr.yml'
#     RE_PUNCTUATION = re.compile(r'\W+')
#     UNNAMED_PATTERN = 'Unnamed check {0}'
#     CREDENTIALS_FILENAME = 'kibitzr-creds.yml'
#     RE_PUNCTUATION = re.compile(r'\W+')
#     UNNAMED_PATTERN = 'Unnamed check {0}'
#     def __init__(self, config_dir):
#     def detect_config_dir(cls):
#     def instance(cls):
#     def reread(self):
#     def read_conf(self):
#     def open_conf(self):
#     def __init__(self, config_dir):
#     def reread(self):
#     def load_extensions(self):
#     def get(self, key, default=None):
#     def __getitem__(self, key):
#     def __init__(self, config_dir):
#     def __contains__(self, key):
#     def __getitem__(self, key):
#     def reread(self):
#     def open_creds(self):
# def settings():
#     def parse_checks(self, conf):
#     def inject_notifiers(check, notifiers):
#     def inject_scenarios(check, scenarios):
#     def expand_schedule(check):
#     def unpack_batches(checks):
#     def inject_missing_names(cls, checks):
#     def url_to_name(cls, url):
#     def unpack_templates(checks, templates):
# 
# Path: kibitzr/timeline.py
# class Timeline(object):
#     RE_TIME = re.compile(r'\d?\d:\d\d')
#     def __init__(self, scheduler=None):
#     def parse_check(cls, check):
#     def _clean_single_schedule(cls, check, schedule_dict):
#     def _clean_unit(check, unit):
#     def _clean_at(cls, check, at):
#     def schedule_checks(self, checkers):
# def parse_check(check):
# def run_pending():
# def schedule_checks(checkers):
# 
# Path: tests/compat.py

# 
# Path: tests/unit/helpers.py
# @contextlib.contextmanager
# def patch_conf(data):
#     with patch_source(ReloadableSettings, 'open_conf', data) as fake_method:
#         yield fake_method
# 
# @contextlib.contextmanager
# def patch_creds(data):
#     with patch_source(PlainYamlCreds, 'open_creds', data) as fake_method:
#         yield fake_method


# Path: tests/unit/test_conf.py
import pytest
from kibitzr.conf import (
    settings,
    ReloadableSettings,
    ConfigurationError,
)
from kibitzr.timeline import TimelineRule
from ..compat import mock
from .helpers import patch_conf, patch_creds

        'url': "https://www.worldtimeserver.com/current_time_in_US-NY.aspx",
        'transform': [{'css': 'span#theTime'}, 'text'],
        'notify': [{'python': 'print(content)'}],
        'schedule': [TimelineRule(interval=1, unit='day', at='20:30')]
    },
    {
        'name': 'Crazy scheduling alarm',
        'url': "https://www.worldtimeserver.com/current_time_in_US-NY.aspx",
        'transform': [{'css': 'span#theTime'}, 'text'],
        'notify': [{'python': 'print(content)'}],
        'schedule': [
            TimelineRule(interval=1, unit='days', at='15:30'),
            TimelineRule(interval=1, unit='hour', at=None),
            TimelineRule(interval=4, unit='minutes', at=None),
            TimelineRule(interval=1, unit='saturday', at='11:17')
        ]
    },
]

creds = {
    'mailgun': {'url': 'ZZZ'},
}

notifiers = {
    'slack': {'url': 'XXX'},
}


def test_complex_conf_sample():
    with patch_conf(sample_conf):

        with patch_creds(sample_creds):