# Path: nanoservice/config.py
# class DotDict(dict):
#     def __getattr__(self, key):
#     def __setattr__(self, key, value):
# def load(filepath=None, filecontent=None):


import json
import unittest
from nanoservice import *
from nanoservice import config



class TestConfig(unittest.TestCase):

    def setUp(self):
        self.addr = 'ipc:///whatever'
        self.expected = {
            'db.name': 'test',
            'rq.requester': 'ipc:///whatever',
            'rs.responder': 'ipc:///whatever',
            'pb.publisher': 'ipc:///whatever',
            'sb.subscriber': 'ipc:///whatever',
        }

    def tearDown(self):
        pass

    def test_config_load(self):
        C = config.load("test/testdata/configuration.json")
        self.assertTrue(C.keys(), self.expected.keys())
        self.assertTrue(C.values(), self.expected.values())

    def test_config_load_with_content(self):
        filec = json.dumps(self.expected)

# Path: nanoservice/config.py
# class DotDict(dict):
#     def __getattr__(self, key):
#     def __setattr__(self, key, value):
# def load(filepath=None, filecontent=None):


# Path: test/test_config.py
import json
import unittest
from nanoservice import *
from nanoservice import config




class TestConfig(unittest.TestCase):

    def setUp(self):
        self.addr = 'ipc:///whatever'
        self.expected = {
            'db.name': 'test',
            'rq.requester': 'ipc:///whatever',
            'rs.responder': 'ipc:///whatever',
            'pb.publisher': 'ipc:///whatever',
            'sb.subscriber': 'ipc:///whatever',
        }

    def tearDown(self):
        pass

    def test_config_load(self):
        C = config.load("test/testdata/configuration.json")
        self.assertTrue(C.keys(), self.expected.keys())
        self.assertTrue(C.values(), self.expected.values())

    def test_config_load_with_content(self):
        filec = json.dumps(self.expected)

        C = config.load(filecontent=filec)