# Path: pyca/db.py
# def init():
# def get_session():
# def with_session(f):
#     def decorated(*args, **kwargs):
#     def values(cls):
#     def str(cls, value):
#     def get_data(self):
#     def set_data(self, data):
#     def name(self):
#     def directory(self):
#     def remaining_duration(self, time):
#     def status_str(self):
#     def get_tracks(self):
#     def set_tracks(self, tracks):
#     def __repr__(self):
#     def serialize(self):
#     def __init__(self, event=None):
#     def __init__(self, service=None):
#     def update_sync_time(url):
# class Constants():
# class Status(Constants):
# class ServiceStatus(Constants):
# class Service(Constants):
# class BaseEvent():
# class UpcomingEvent(Base, BaseEvent):
# class RecordedEvent(Base, BaseEvent):
# class ServiceStates(Base):
# class UpstreamState(Base):
#     UPCOMING = 1
#     RECORDING = 2
#     FAILED_RECORDING = 3
#     FINISHED_RECORDING = 4
#     UPLOADING = 5
#     FAILED_UPLOADING = 6
#     FINISHED_UPLOADING = 7
#     PARTIAL_RECORDING = 8
#     PAUSED_AFTER_RECORDING = 9
#     STOPPED = 1
#     IDLE = 2
#     BUSY = 3
#     AGENTSTATE = 1
#     CAPTURE = 2
#     INGEST = 3
#     SCHEDULE = 4
# 
# Path: pyca/config.py
# def config(*args):
#     '''Get a specific configuration value or the whole configuration, loading
#     the configuration file if it was not before.
# 
#     :param key: optional configuration key to return
#     :type key: string
#     :return: Part of the configuration object containing the configuration
#              or configuration value.
#              If a part of the configuration object (e.g. configobj.Section) is
#              returned, it can be treated like a dictionary.
#              Returning None, if the configuration value is not found.
#     '''
#     cfg = __config or update_configuration()
#     for key in args:
#         if cfg is None:
#             return
#         cfg = cfg.get(key)
#     return cfg


import unittest
import tempfile
import os
from pyca import db, config
# -*- coding: utf-8 -*-

'''
Tests for database
'''




class TestPycaDb(unittest.TestCase):

    dbfile = None

    def setUp(self):
        cfg = './etc/pyca.conf'
        config.update_configuration(cfg)

        self.fd, self.dbfile = tempfile.mkstemp()

# Path: pyca/db.py
# def init():
# def get_session():
# def with_session(f):
#     def decorated(*args, **kwargs):
#     def values(cls):
#     def str(cls, value):
#     def get_data(self):
#     def set_data(self, data):
#     def name(self):
#     def directory(self):
#     def remaining_duration(self, time):
#     def status_str(self):
#     def get_tracks(self):
#     def set_tracks(self, tracks):
#     def __repr__(self):
#     def serialize(self):
#     def __init__(self, event=None):
#     def __init__(self, service=None):
#     def update_sync_time(url):
# class Constants():
# class Status(Constants):
# class ServiceStatus(Constants):
# class Service(Constants):
# class BaseEvent():
# class UpcomingEvent(Base, BaseEvent):
# class RecordedEvent(Base, BaseEvent):
# class ServiceStates(Base):
# class UpstreamState(Base):
#     UPCOMING = 1
#     RECORDING = 2
#     FAILED_RECORDING = 3
#     FINISHED_RECORDING = 4
#     UPLOADING = 5
#     FAILED_UPLOADING = 6
#     FINISHED_UPLOADING = 7
#     PARTIAL_RECORDING = 8
#     PAUSED_AFTER_RECORDING = 9
#     STOPPED = 1
#     IDLE = 2
#     BUSY = 3
#     AGENTSTATE = 1
#     CAPTURE = 2
#     INGEST = 3
#     SCHEDULE = 4
# 
# Path: pyca/config.py
# def config(*args):
#     '''Get a specific configuration value or the whole configuration, loading
#     the configuration file if it was not before.
# 
#     :param key: optional configuration key to return
#     :type key: string
#     :return: Part of the configuration object containing the configuration
#              or configuration value.
#              If a part of the configuration object (e.g. configobj.Section) is
#              returned, it can be treated like a dictionary.
#              Returning None, if the configuration value is not found.
#     '''
#     cfg = __config or update_configuration()
#     for key in args:
#         if cfg is None:
#             return
#         cfg = cfg.get(key)
#     return cfg


# Path: tests/test_db.py
import unittest
import tempfile
import os
from pyca import db, config

# -*- coding: utf-8 -*-

'''
Tests for database
'''




class TestPycaDb(unittest.TestCase):

    dbfile = None

    def setUp(self):
        cfg = './etc/pyca.conf'
        config.update_configuration(cfg)

        self.fd, self.dbfile = tempfile.mkstemp()

        config.config()['agent']['database'] = 'sqlite:///' + self.dbfile