# Path: kafka_influxdb/config/loader.py
# class ObjectView(object):
#     def __init__(self, d):
# def load_config():
# def overwrite_config(old_values, new_values):
# def parse_configfile(configfile):
# def flatten(d, parent_key='', sep='_'):
# def parse_args(args=sys.argv[1:]):
# 
# Path: kafka_influxdb/config/default_config.py
# DEFAULT_CONFIG = {
#     'kafka': {
#         'host': 'localhost',
#         'port': '9092',
#         'topic': 'my_topic',
#         'group': 'kafka-influxdb',
#         'reconnect_wait_time_ms': 1000,
#         'reader': 'kafka_influxdb.reader.confluent',
#         'offset': 'largest',
#     },
#     'influxdb': {
#         'host': 'localhost',
#         'port': 8086,
#         'user': 'root',
#         'password': 'root',
#         'dbname': 'metrics',
#         'use_ssl': False,
#         'verify_ssl': False,
#         'timeout': 5,
#         'use_udp': False,
#         'retention_policy': 'autogen',
#         'time_precision': 's',
#     },
#     'encoder': 'kafka_influxdb.encoder.collectd_graphite_encoder',
#     'buffer_size': 1000,
#     'buffer_timeout': False,
#     'configfile': None,
#     'c': None,
#     'statistics': False,
#     's': False,
#     'verbose': 0,
#     'v': 0
# }


import unittest
import os
import argparse
from mock import MagicMock
from kafka_influxdb.config import loader, default_config
        self.assertEqual(parsed_config["kafka"]["host"], "kafkahost")
        self.assertEqual(parsed_config["kafka"]["port"], 1234)
        self.assertEqual(parsed_config["kafka"]["topic"], "kafkatopic")
        self.assertEqual(parsed_config["kafka"]["group"], "foogroup")
        self.assertEqual(parsed_config["influxdb"]["host"], "influxdbhost")
        self.assertEqual(parsed_config["influxdb"]["port"], 9999)
        self.assertEqual(parsed_config["influxdb"]["user"], "hans")
        self.assertEqual(parsed_config["influxdb"]["password"], "hans")
        self.assertEqual(parsed_config["influxdb"]["dbname"], "influxdbname")
        self.assertEqual(parsed_config["influxdb"]["use_ssl"], True)
        self.assertEqual(parsed_config["influxdb"]["verify_ssl"], True)
        self.assertEqual(parsed_config["influxdb"]["timeout"], 9000)
        self.assertEqual(parsed_config["influxdb"]["use_udp"], False)
        self.assertEqual(parsed_config["influxdb"]
                         ["retention_policy"], "my_rp")
        self.assertEqual(parsed_config["encoder"], "collectd_graphite_encoder")
        self.assertEqual(parsed_config["buffer_size"], 444)
        self.assertEqual(parsed_config["statistics"], True)

    def test_argparse_flags(self):
        long_flags = [
            'influxdb_use_ssl',
            'influxdb_verify_ssl',
            'influxdb_use_udp',
            'statistics'
        ]
        for flag in long_flags:
            parsed = loader.parse_args(['--' + flag])
            self.assertEqual(parsed[flag], True)


# Path: kafka_influxdb/config/loader.py
# class ObjectView(object):
#     def __init__(self, d):
# def load_config():
# def overwrite_config(old_values, new_values):
# def parse_configfile(configfile):
# def flatten(d, parent_key='', sep='_'):
# def parse_args(args=sys.argv[1:]):
# 
# Path: kafka_influxdb/config/default_config.py
# DEFAULT_CONFIG = {
#     'kafka': {
#         'host': 'localhost',
#         'port': '9092',
#         'topic': 'my_topic',
#         'group': 'kafka-influxdb',
#         'reconnect_wait_time_ms': 1000,
#         'reader': 'kafka_influxdb.reader.confluent',
#         'offset': 'largest',
#     },
#     'influxdb': {
#         'host': 'localhost',
#         'port': 8086,
#         'user': 'root',
#         'password': 'root',
#         'dbname': 'metrics',
#         'use_ssl': False,
#         'verify_ssl': False,
#         'timeout': 5,
#         'use_udp': False,
#         'retention_policy': 'autogen',
#         'time_precision': 's',
#     },
#     'encoder': 'kafka_influxdb.encoder.collectd_graphite_encoder',
#     'buffer_size': 1000,
#     'buffer_timeout': False,
#     'configfile': None,
#     'c': None,
#     'statistics': False,
#     's': False,
#     'verbose': 0,
#     'v': 0
# }


# Path: kafka_influxdb/tests/config_test/test_config.py
import unittest
import os
import argparse
from mock import MagicMock
from kafka_influxdb.config import loader, default_config

        self.assertEqual(parsed_config["kafka"]["host"], "kafkahost")
        self.assertEqual(parsed_config["kafka"]["port"], 1234)
        self.assertEqual(parsed_config["kafka"]["topic"], "kafkatopic")
        self.assertEqual(parsed_config["kafka"]["group"], "foogroup")
        self.assertEqual(parsed_config["influxdb"]["host"], "influxdbhost")
        self.assertEqual(parsed_config["influxdb"]["port"], 9999)
        self.assertEqual(parsed_config["influxdb"]["user"], "hans")
        self.assertEqual(parsed_config["influxdb"]["password"], "hans")
        self.assertEqual(parsed_config["influxdb"]["dbname"], "influxdbname")
        self.assertEqual(parsed_config["influxdb"]["use_ssl"], True)
        self.assertEqual(parsed_config["influxdb"]["verify_ssl"], True)
        self.assertEqual(parsed_config["influxdb"]["timeout"], 9000)
        self.assertEqual(parsed_config["influxdb"]["use_udp"], False)
        self.assertEqual(parsed_config["influxdb"]
                         ["retention_policy"], "my_rp")
        self.assertEqual(parsed_config["encoder"], "collectd_graphite_encoder")
        self.assertEqual(parsed_config["buffer_size"], 444)
        self.assertEqual(parsed_config["statistics"], True)

    def test_argparse_flags(self):
        long_flags = [
            'influxdb_use_ssl',
            'influxdb_verify_ssl',
            'influxdb_use_udp',
            'statistics'
        ]
        for flag in long_flags:
            parsed = loader.parse_args(['--' + flag])
            self.assertEqual(parsed[flag], True)


        parsed = loader.parse_args(['-s'])