# Path: attributes/management/main.py
# 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.management import main
from lib import database
                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)

    def test_main(self):
        # Arrange
        project_id = 10868464  # andymeneely/squib
        options = {
            'threshold': 1,
            'today': '2015-04-01'
        }

        # Act
        try:
            self.database.connect()
            with self.database.cursor() as cursor:
                (result, value) = main.run(project_id, '', cursor, **options)
        finally:

# Path: attributes/management/main.py
# 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/management/test_main.py
import json
import os
import unittest
from attributes.management import main
from lib import database

                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)

    def test_main(self):
        # Arrange
        project_id = 10868464  # andymeneely/squib
        options = {
            'threshold': 1,
            'today': '2015-04-01'
        }

        # Act
        try:
            self.database.connect()
            with self.database.cursor() as cursor:
                (result, value) = main.run(project_id, '', cursor, **options)
        finally:

            self.database.disconnect()