'Test errors if component & platform not found.'

def test_config_component_platform_fail_validation(self):

    files = {'component.yaml': (BASE_CONFIG + 'http:\n        password:    err123')}
    with patch_yaml_files(files):
        res = check_config.check(get_test_config_dir('component.yaml'))
        change_yaml_files(res)
        self.assertDictEqual({}, res['components'])
        res['except'].pop(check_config.ERROR_STR)
        self.assertDictEqual({'http': {'password': 'err123'}}, res['except'])
        self.assertDictEqual({}, res['secret_cache'])
        self.assertDictEqual({}, res['secrets'])
        self.assertListEqual(['.../component.yaml'], res['yaml_files'])
    files = {'platform.yaml': (BASE_CONFIG + 'mqtt:\n\nlight:\n        platform:    mqtt_json')}
    with patch_yaml_files(files):
        res = check_config.check(get_test_config_dir('platform.yaml'))
        change_yaml_files(res)
        self.assertDictEqual({'mqtt': {'keepalive': 60, 'port': 1883, 'protocol': '3.1.1', 'discovery': False, 'discovery_prefix': 'homeassistant', 'tls_version': 'auto'}, 'light': [], 'group': None}, res['components'])
        self.assertDictEqual({'light.mqtt_json': {'platform': 'mqtt_json'}}, res['except'])
        self.assertDictEqual({}, res['secret_cache'])
        self.assertDictEqual({}, res['secrets'])
        self.assertListEqual(['.../platform.yaml'], res['yaml_files'])
