def test_custom_dictionaries(self):
        request_endpoint1 = 'test/{testSomething}/moreTest'
        request_endpoint2 = 'different/{other}/somethingElse'
        request_endpoint3 = 'final/{testing}/theEnd'
        dict1 = "dict1.json"
        dict2 = "dict2.json"

        settings_file = {
            'per_resource_settings': {
                request_endpoint1: {
                    'custom_dictionary': dict1
                },
                request_endpoint2: {
                    'custom_dictionary': dict2
                },
                request_endpoint3: {}
            }
        }

        RestlerSettings(settings_file)
        custom_dicts = RestlerSettings.Instance(
        ).get_endpoint_custom_mutations_paths()

        self.assertEqual(2, len(custom_dicts))
        self.assertEqual(dict1, custom_dicts[hex_def(request_endpoint1)])
        self.assertEqual(dict2, custom_dicts[hex_def(request_endpoint2)])
        self.assertTrue(hex_def(request_endpoint3) not in custom_dicts)
    def test_create_once(self):
        request_endpoint1 = 'test/{testSomething}/moreTest'
        request_endpoint2 = 'different/{other}/somethingElse'
        request_endpoint3 = 'final/{testing}/theEnd'

        settings_file = {
            'per_resource_settings': {
                request_endpoint1: {
                    'create_once': 1
                },
                request_endpoint2: {
                    'create_once': 1
                },
                request_endpoint3: {
                    'create_once': 0
                }
            }
        }

        RestlerSettings(settings_file)
        create_once_list = RestlerSettings.Instance().create_once_endpoints

        self.assertEqual(2, len(create_once_list))

        self.assertEqual(True, hex_def(request_endpoint1) in create_once_list)
        self.assertEqual(True, hex_def(request_endpoint2) in create_once_list)
        self.assertNotEqual(True,
                            hex_def(request_endpoint3) in create_once_list)
    def test_single_instance(self):
        settings1 = RestlerSettings({})
        settings2 = RestlerSettings.Instance()

        self.assertEqual(settings1, settings2)
        with self.assertRaises(NewSingletonError):
            # Test can't create new instance
            RestlerSettings({})
 def test_not_yet_initialzed(self):
     with self.assertRaises(UninitializedError):
         settings = RestlerSettings.Instance()