# Path: articlemeta/controller.py
# LIMIT = 1000
# def dates_to_string(data):
# def get_date_range_filter(from_date=None, until_date=None):
# def get_dbconn(db_dsn):
#     def _create_indexes(db):
#     def __init__(self, db, journalmeta):
#     def check(self, metadata):
#     def identifiers(self, collection=None, issn=None,
#             from_date='1500-01-01', until_date=None, limit=None, offset=0,
#             extra_filter=None):
#     def get(self, code, collection=None, replace_journal_metadata=False):
#     def get_issues_full(self, collection=None, issn=None, from_date='1500-01-01',
#             until_date=None, limit=LIMIT, offset=0, extra_filter=None):
#     def exists(self, code, collection=None):
#     def delete(self, code, collection=None):
#     def add(self, metadata):
#     def update(self, metadata):
#     def get_code_from_label(self, label, journal_code, collection):
#     def _get_code_from_label_list(self, label, journal_code, collection):
#     def _get_code_from_label_str(self, label, journal_code, collection):
#     def __init__(self, db):
#     def check(self, metadata):
#     def get(self, collection=None, issn=None):
#     def delete(self, code, collection):
#     def add(self, metadata):
#     def update(self, metadata):
#     def identifiers(self, collection=None, issn=None, limit=None,
#             offset=0, extra_filter=None):
#     def exists(self, code, collection=None):
#     def __init__(self, db, journalmeta, issuemeta):
#     def check(self, metadata):
#     def identifiers(self, collection=None, issn=None, from_date='1500-01-01',
#             until_date=None, limit=LIMIT, offset=0, extra_filter=None):
#     def get(self, code, collection=None, replace_journal_metadata=False, body=False):
#     def get_articles_full(self, collection=None, issn=None,
#             from_date='1500-01-01', until_date=None, limit=100, offset=0,
#             extra_filter=None, replace_journal_metadata=False, body=False):
#     def exists(self, code, collection=None):
#     def delete(self, code, collection=None):
#     def add(self, metadata):
#     def update(self, metadata):
#     def identifiers_press_release(self, collection=None, issn=None,
#             from_date='1500-01-01', until_date=None, limit=LIMIT, offset=0):
#     def set_doaj_id(self, code, collection, doaj_id):
#     def set_aid(self, code, collection, aid):
#     def __init__(self, pubstatus, filepath=COLLECTIONS_PATH):
#     def _data(self):
#     def _add_counts(self, data, docs_count):
#     def identifiers(self):
#     def get(self, collection):
#     def __init__(self, host='http://publication.scielo.org'):
#     def documents_count(self):
#     def journals_count(self, collection):
#     def __init__(self, db_client):
#     def _log_changes(self, document_type, code, event, collection=None, date=None):
#     def historychanges(self, document_type, collection=None, event=None,
#                        code=None, from_date='1997-01-01',
#                        until_date=None, limit=LIMIT, offset=0):
#     def get_journal(self, collection=None, issn=None):
#     def delete_journal(self, code, collection=None):
#     def add_journal(self, metadata):
#     def update_journal(self, metadata):
#     def identifiers_collection(self):
#     def get_collection(self, collection):
#     def collection(self, collection=None):
#     def identifiers_journal(self, collection=None, issn=None, limit=LIMIT,
#             offset=0, extra_filter=None):
#     def identifiers_issue(self, collection=None, issn=None,
#             from_date='1500-01-01', until_date=None, limit=LIMIT, offset=0,
#             extra_filter=None):
#     def get_issue(self, code, collection=None, replace_journal_metadata=False):
#     def get_issues_full(self, collection=None, issn=None, from_date='1500-01-01',
#             until_date=None, limit=LIMIT, offset=0, extra_filter=None):
#     def get_issues(self, code, collection=None, replace_journal_metadata=False):
#     def exists_journal(self, code, collection=None):
#     def exists_issue(self, code, collection=None):
#     def delete_issue(self, code, collection=None):
#     def add_issue(self, metadata):
#     def update_issue(self, metadata):
#     def identifiers_article(self,
#                             collection=None,
#                             issn=None,
#                             from_date='1500-01-01',
#                             until_date=None,
#                             limit=LIMIT,
#                             offset=0,
#                             extra_filter=None):
#     def identifiers_press_release(self,
#                                   collection=None,
#                                   issn=None,
#                                   from_date='1500-01-01',
#                                   until_date=None,
#                                   limit=LIMIT,
#                                   offset=0):
#     def get_article(self, code, collection=None, replace_journal_metadata=False,
#             body=False):
#     def get_articles_full(self, collection=None, issn=None,
#             from_date='1500-01-01', until_date=None, limit=100, offset=0,
#             extra_filter=None, replace_journal_metadata=False, body=False):
#     def get_articles(self, code, collection=None, replace_journal_metadata=False):
#     def exists_article(self, code, collection=None):
#     def delete_article(self, code, collection=None):
#     def add_article(self, metadata):
#     def update_article(self, metadata):
#     def set_doaj_id(self, code, collection, doaj_id):
#     def set_aid(self, code, collection, aid):
#     def get_issue_code_from_label(self, label, journal_code, collection):
# class IssueMeta:
# class JournalMeta:
# class ArticleMeta:
# class CollectionMeta:
# class PublicationStatus:
# class DataBroker(object):


import unittest
from datetime import datetime
from articlemeta import controller


class FunctionDatesToStringTests(unittest.TestCase):
    def test_converts_datatime_in_processing_date_value(self):
        data = {'processing_date': datetime(2017, 9, 14)}
        expected_result = {'processing_date': '2017-09-14'}

# Path: articlemeta/controller.py
# LIMIT = 1000
# def dates_to_string(data):
# def get_date_range_filter(from_date=None, until_date=None):
# def get_dbconn(db_dsn):
#     def _create_indexes(db):
#     def __init__(self, db, journalmeta):
#     def check(self, metadata):
#     def identifiers(self, collection=None, issn=None,
#             from_date='1500-01-01', until_date=None, limit=None, offset=0,
#             extra_filter=None):
#     def get(self, code, collection=None, replace_journal_metadata=False):
#     def get_issues_full(self, collection=None, issn=None, from_date='1500-01-01',
#             until_date=None, limit=LIMIT, offset=0, extra_filter=None):
#     def exists(self, code, collection=None):
#     def delete(self, code, collection=None):
#     def add(self, metadata):
#     def update(self, metadata):
#     def get_code_from_label(self, label, journal_code, collection):
#     def _get_code_from_label_list(self, label, journal_code, collection):
#     def _get_code_from_label_str(self, label, journal_code, collection):
#     def __init__(self, db):
#     def check(self, metadata):
#     def get(self, collection=None, issn=None):
#     def delete(self, code, collection):
#     def add(self, metadata):
#     def update(self, metadata):
#     def identifiers(self, collection=None, issn=None, limit=None,
#             offset=0, extra_filter=None):
#     def exists(self, code, collection=None):
#     def __init__(self, db, journalmeta, issuemeta):
#     def check(self, metadata):
#     def identifiers(self, collection=None, issn=None, from_date='1500-01-01',
#             until_date=None, limit=LIMIT, offset=0, extra_filter=None):
#     def get(self, code, collection=None, replace_journal_metadata=False, body=False):
#     def get_articles_full(self, collection=None, issn=None,
#             from_date='1500-01-01', until_date=None, limit=100, offset=0,
#             extra_filter=None, replace_journal_metadata=False, body=False):
#     def exists(self, code, collection=None):
#     def delete(self, code, collection=None):
#     def add(self, metadata):
#     def update(self, metadata):
#     def identifiers_press_release(self, collection=None, issn=None,
#             from_date='1500-01-01', until_date=None, limit=LIMIT, offset=0):
#     def set_doaj_id(self, code, collection, doaj_id):
#     def set_aid(self, code, collection, aid):
#     def __init__(self, pubstatus, filepath=COLLECTIONS_PATH):
#     def _data(self):
#     def _add_counts(self, data, docs_count):
#     def identifiers(self):
#     def get(self, collection):
#     def __init__(self, host='http://publication.scielo.org'):
#     def documents_count(self):
#     def journals_count(self, collection):
#     def __init__(self, db_client):
#     def _log_changes(self, document_type, code, event, collection=None, date=None):
#     def historychanges(self, document_type, collection=None, event=None,
#                        code=None, from_date='1997-01-01',
#                        until_date=None, limit=LIMIT, offset=0):
#     def get_journal(self, collection=None, issn=None):
#     def delete_journal(self, code, collection=None):
#     def add_journal(self, metadata):
#     def update_journal(self, metadata):
#     def identifiers_collection(self):
#     def get_collection(self, collection):
#     def collection(self, collection=None):
#     def identifiers_journal(self, collection=None, issn=None, limit=LIMIT,
#             offset=0, extra_filter=None):
#     def identifiers_issue(self, collection=None, issn=None,
#             from_date='1500-01-01', until_date=None, limit=LIMIT, offset=0,
#             extra_filter=None):
#     def get_issue(self, code, collection=None, replace_journal_metadata=False):
#     def get_issues_full(self, collection=None, issn=None, from_date='1500-01-01',
#             until_date=None, limit=LIMIT, offset=0, extra_filter=None):
#     def get_issues(self, code, collection=None, replace_journal_metadata=False):
#     def exists_journal(self, code, collection=None):
#     def exists_issue(self, code, collection=None):
#     def delete_issue(self, code, collection=None):
#     def add_issue(self, metadata):
#     def update_issue(self, metadata):
#     def identifiers_article(self,
#                             collection=None,
#                             issn=None,
#                             from_date='1500-01-01',
#                             until_date=None,
#                             limit=LIMIT,
#                             offset=0,
#                             extra_filter=None):
#     def identifiers_press_release(self,
#                                   collection=None,
#                                   issn=None,
#                                   from_date='1500-01-01',
#                                   until_date=None,
#                                   limit=LIMIT,
#                                   offset=0):
#     def get_article(self, code, collection=None, replace_journal_metadata=False,
#             body=False):
#     def get_articles_full(self, collection=None, issn=None,
#             from_date='1500-01-01', until_date=None, limit=100, offset=0,
#             extra_filter=None, replace_journal_metadata=False, body=False):
#     def get_articles(self, code, collection=None, replace_journal_metadata=False):
#     def exists_article(self, code, collection=None):
#     def delete_article(self, code, collection=None):
#     def add_article(self, metadata):
#     def update_article(self, metadata):
#     def set_doaj_id(self, code, collection, doaj_id):
#     def set_aid(self, code, collection, aid):
#     def get_issue_code_from_label(self, label, journal_code, collection):
# class IssueMeta:
# class JournalMeta:
# class ArticleMeta:
# class CollectionMeta:
# class PublicationStatus:
# class DataBroker(object):


# Path: tests/test_controller.py
import unittest
from datetime import datetime
from articlemeta import controller



class FunctionDatesToStringTests(unittest.TestCase):
    def test_converts_datatime_in_processing_date_value(self):
        data = {'processing_date': datetime(2017, 9, 14)}
        expected_result = {'processing_date': '2017-09-14'}

        self.assertEqual(controller.dates_to_string(data), expected_result)