'Test get_check_tpls from docker labesl'

@mock.patch('config.get_auto_confd_path', return_value=os.path.join(os.path.dirname(__file__), 'fixtures/auto_conf/'))
@mock.patch.object(AbstractConfigStore, 'client_read', side_effect=client_read)
def test_get_check_tpls_labels(self, *args):

    valid_config = ['image_0', 'image_1', 'image_2', 'image_3', 'image_4']
    invalid_config = ['bad_image_0']
    config_store = get_config_store(self.auto_conf_agentConfig)
    for image in (valid_config + invalid_config):
        tpl = self.mock_raw_templates.get(image)[1]
        tpl = [(CONFIG_FROM_LABELS, t[1]) for t in tpl]
        if tpl:
            self.assertNotEquals(tpl, config_store.get_check_tpls(image, auto_conf=True))
        self.assertEquals(tpl, config_store.get_check_tpls(image, auto_conf=True, docker_labels=dict(zip(['com.datadoghq.ad.check_names', 'com.datadoghq.ad.init_configs', 'com.datadoghq.ad.instances'], self.mock_raw_templates[image][0]))))
