# Path: attributes/community/main.py
# QUERY = '''
#     SELECT c.author_id, COUNT(*)
#     FROM commits c JOIN project_commits pc
#       ON pc.commit_id = c.id
#     WHERE pc.project_id = {0}
#     GROUP BY c.author_id
#     ORDER BY COUNT(*) DESC
# '''
# def run(project_id, repo_path, cursor, **options):
# 
# Path: lib/database.py
# class DatabaseError(Exception):
# class Database(object):
#     def __init__(self, value):
#     def __str__(self):
#     def __init__(self, settings):
#     def connect(self):
#     def disconnect(self):
#     def get(self, query):
#     def post(self, query, data=None):
#     def cursor(self):
#     def _connected(self):
#     def __getstate__(self):
#     def __setstate__(self, state):


import json
import os
import unittest
from attributes.community import main
from lib import database



class MainTestCase(unittest.TestCase):
    def setUp(self):
        path = (
            os.path.join(
                os.path.abspath(
                    os.path.join(
                        os.path.dirname(os.path.realpath(__file__)),
                        os.pardir,
                        os.pardir
                    )
                ),
                'config.json'
            )
        )
        settings = None
        with open(path, 'r') as file_:
            settings = json.load(file_)['options']['datasource']


# Path: attributes/community/main.py
# QUERY = '''
#     SELECT c.author_id, COUNT(*)
#     FROM commits c JOIN project_commits pc
#       ON pc.commit_id = c.id
#     WHERE pc.project_id = {0}
#     GROUP BY c.author_id
#     ORDER BY COUNT(*) DESC
# '''
# def run(project_id, repo_path, cursor, **options):
# 
# Path: lib/database.py
# class DatabaseError(Exception):
# class Database(object):
#     def __init__(self, value):
#     def __str__(self):
#     def __init__(self, settings):
#     def connect(self):
#     def disconnect(self):
#     def get(self, query):
#     def post(self, query, data=None):
#     def cursor(self):
#     def _connected(self):
#     def __getstate__(self):
#     def __setstate__(self, state):


# Path: tests/community/test_main.py
import json
import os
import unittest
from attributes.community import main
from lib import database




class MainTestCase(unittest.TestCase):
    def setUp(self):
        path = (
            os.path.join(
                os.path.abspath(
                    os.path.join(
                        os.path.dirname(os.path.realpath(__file__)),
                        os.pardir,
                        os.pardir
                    )
                ),
                'config.json'
            )
        )
        settings = None
        with open(path, 'r') as file_:
            settings = json.load(file_)['options']['datasource']


        self.database = database.Database(settings)