# Path: gitmostwanted/app.py

# 
# Path: gitmostwanted/tasks/repo_stars.py
# def query_stars_by_repo(repo_id: int, date_from: datetime, date_to: datetime):
#     query = """
#         SELECT
#             COUNT(1) AS stars, YEAR(created_at) AS y, DAYOFYEAR(created_at) AS doy,
#             MONTH(created_at) as mon
#         FROM
#             TABLE_DATE_RANGE([githubarchive:day.], TIMESTAMP('{date_from}'), TIMESTAMP('{date_to}'))
#         WHERE
#             repo.id = {id} AND type IN ('WatchEvent', 'ForkEvent')
#         GROUP BY y, mon, doy
#     """
#     return query.format(
#         id=repo_id, date_from=date_from.strftime('%Y-%m-%d'), date_to=date_to.strftime('%Y-%m-%d')
#     )


from datetime import datetime, timedelta
from gitmostwanted.app import db
from gitmostwanted.tasks.repo_stars import query_stars_by_repo
from unittest import TestCase


class TasksRepoStarsTestCase(TestCase):
    @classmethod
    def setUpClass(cls):

# Path: gitmostwanted/app.py

# 
# Path: gitmostwanted/tasks/repo_stars.py
# def query_stars_by_repo(repo_id: int, date_from: datetime, date_to: datetime):
#     query = """
#         SELECT
#             COUNT(1) AS stars, YEAR(created_at) AS y, DAYOFYEAR(created_at) AS doy,
#             MONTH(created_at) as mon
#         FROM
#             TABLE_DATE_RANGE([githubarchive:day.], TIMESTAMP('{date_from}'), TIMESTAMP('{date_to}'))
#         WHERE
#             repo.id = {id} AND type IN ('WatchEvent', 'ForkEvent')
#         GROUP BY y, mon, doy
#     """
#     return query.format(
#         id=repo_id, date_from=date_from.strftime('%Y-%m-%d'), date_to=date_to.strftime('%Y-%m-%d')
#     )


# Path: tests/unit/tasks/test_repo_stars.py
from datetime import datetime, timedelta
from gitmostwanted.app import db
from gitmostwanted.tasks.repo_stars import query_stars_by_repo
from unittest import TestCase



class TasksRepoStarsTestCase(TestCase):
    @classmethod
    def setUpClass(cls):

        db.create_all()