# Path: qpanel/job.py
# DAILY = 1
# WEEKLY = 7
# MONTHLY = 30
# WEEK_DAYS = ['mon', 'tue', 'wed', 'thu', 'fri', 'sat', 'sun']
# def check_connect_redis():
# def to_utc(dt):
# def reset_stats_queue(queuename, when, hour):
# def job_reset_stats_queue(queuename, when, hour):
# def exists_job_onqueue(queuename, when, hour):
# def exists_job_onconfig(queuename, when, hour):
# def remove_jobs_not_config():
# def enqueue_reset_stats():
# def get_days_from_val(val):
# def give_day_number(value):
# def get_now():
# def datetime_from_config(when, hour):
# def last_day_of_month(date):
# def start_jobs():
# def start_process():
# def start_workers(qs=['default']):


import os
import unittest
import mock
from qpanel import job
from datetime import datetime
                         )

    @mock.patch('qpanel.job.get_now')
    def test_monthy_today(self, mock):
        """ Should return at the next month"""
        mock.return_value = datetime(2019, 11, 1, 20, 50, 30)
        self.assertEqual(job.datetime_from_config('monthly', '22:50:50'),
                         datetime(2019, 11, 1, 22, 50, 50)
                         )

    @mock.patch('qpanel.job.get_now')
    def test_fri_today(self, mock):
        """ Should return at the today """
        mock.return_value = datetime(2019, 11, 1, 20, 50, 30)
        self.assertEqual(job.datetime_from_config('fri', '22:50:50'),
                         datetime(2019, 11, 1, 22, 50, 50)
                         )

    @mock.patch('qpanel.job.get_now')
    def test_next_friday(self, mock):
        """ Should return the next friday today """
        mock.return_value = datetime(2019, 11, 1, 20, 50, 30)
        self.assertEqual(job.datetime_from_config('fri', '19:50:50'),
                         datetime(2019, 11, 8, 19, 50, 50)
                         )

    @mock.patch('qpanel.job.get_now')
    def test_next_monday(self, mock):
        """ Should return the next friday today """
        mock.return_value = datetime(2019, 11, 1, 20, 50, 30)

# Path: qpanel/job.py
# DAILY = 1
# WEEKLY = 7
# MONTHLY = 30
# WEEK_DAYS = ['mon', 'tue', 'wed', 'thu', 'fri', 'sat', 'sun']
# def check_connect_redis():
# def to_utc(dt):
# def reset_stats_queue(queuename, when, hour):
# def job_reset_stats_queue(queuename, when, hour):
# def exists_job_onqueue(queuename, when, hour):
# def exists_job_onconfig(queuename, when, hour):
# def remove_jobs_not_config():
# def enqueue_reset_stats():
# def get_days_from_val(val):
# def give_day_number(value):
# def get_now():
# def datetime_from_config(when, hour):
# def last_day_of_month(date):
# def start_jobs():
# def start_process():
# def start_workers(qs=['default']):


# Path: tests/test_job.py
import os
import unittest
import mock
from qpanel import job
from datetime import datetime

                         )

    @mock.patch('qpanel.job.get_now')
    def test_monthy_today(self, mock):
        """ Should return at the next month"""
        mock.return_value = datetime(2019, 11, 1, 20, 50, 30)
        self.assertEqual(job.datetime_from_config('monthly', '22:50:50'),
                         datetime(2019, 11, 1, 22, 50, 50)
                         )

    @mock.patch('qpanel.job.get_now')
    def test_fri_today(self, mock):
        """ Should return at the today """
        mock.return_value = datetime(2019, 11, 1, 20, 50, 30)
        self.assertEqual(job.datetime_from_config('fri', '22:50:50'),
                         datetime(2019, 11, 1, 22, 50, 50)
                         )

    @mock.patch('qpanel.job.get_now')
    def test_next_friday(self, mock):
        """ Should return the next friday today """
        mock.return_value = datetime(2019, 11, 1, 20, 50, 30)
        self.assertEqual(job.datetime_from_config('fri', '19:50:50'),
                         datetime(2019, 11, 8, 19, 50, 50)
                         )

    @mock.patch('qpanel.job.get_now')
    def test_next_monday(self, mock):
        """ Should return the next friday today """
        mock.return_value = datetime(2019, 11, 1, 20, 50, 30)

        self.assertEqual(job.datetime_from_config('mon', '19:50:50'),