def patch_datetime_now_fail(monkeypatch): reminder = nlprg_schedule_reader.Reminder(config) class mydatetime: @classmethod def now(cls): return FAKE_TIME_FAIL @classmethod def today(cls): return FAKE_TIME_FAIL # class myBeautifulSoup: # def __init__(self, thing, otherthing): # return open("resources/Fall-2017-Reading-Schedule.md", "r").read() monkeypatch.setattr(datetime, 'datetime', mydatetime) # monkeypatch.setattr(bs4, 'BeautifulSopu', myBeautifulSoup) return reminder
def patch_datetime_last_minute(monkeypatch): class mydatetime(datetime.datetime): def __init__(self, y, m, d, h): self = DATE_GENERATOR(y, m, d) @classmethod def now(cls): return FAKE_TIME_LAST_MINUTE @classmethod def today(cls): return FAKE_TIME_LAST_MINUTE # class myBeautifulSoup: # def __init__(self, thing, otherthing): # return open("resources/Fall-2017-Reading-Schedule.md", "r").read() monkeypatch.setattr(datetime, 'datetime', mydatetime) # monkeypatch.setattr(bs4, 'BeautifulSopu', myBeautifulSoup) reminder = nlprg_schedule_reader.Reminder(config) return reminder
def test_constructor(): reminder = nlprg_schedule_reader.Reminder(config)
from lingbot.features import generic_schedule_reader, nlprg_schedule_reader, hacky_hour_reminder import datetime constructors = { "hackyHourReminder": lambda x: hacky_hour_reminder.Reminder(x), "nlprgReminder": lambda x: nlprg_schedule_reader.Reminder(x), "genericReminder": lambda x: generic_schedule_reader.Reminder(x) } general = "C0AF685U7" bot_test = "C25NW0WN7" randomchannel = "C0AEYNKA4" class Passive(): def __init__(self, slack_client, config): config = config["features"]["passive"] self.config = config self.reminder_objects = [] for feat in config: self.reminder_objects.append(constructors[feat](config[feat])) self.slack_client = slack_client def check(self): ''' This function is run every second. If you have something you want to happen at a particular time, put it here, following the template of the others ''' send = 0