def test_cache_dir_with_alternate_cachedir_and_relative_path(self):
        patched_opts = dict((x, y) for x, y in six.iteritems(self.minion_opts))
        patched_opts.update(MOCKED_OPTS)
        alt_cachedir = 'foo'

        with patch.dict(fileclient.__opts__, patched_opts):
            client = fileclient.get_file_client(fileclient.__opts__, pillar=False)
            for saltenv in SALTENVS:
                self.assertTrue(
                    client.cache_dir(
                        'salt://{0}'.format(SUBDIR),
                        saltenv,
                        cachedir=alt_cachedir
                    )
                )
                for subdir_file in SUBDIR_FILES:
                    cache_loc = os.path.join(fileclient.__opts__['cachedir'],
                                             alt_cachedir,
                                             'files',
                                             saltenv,
                                             SUBDIR,
                                             subdir_file)
                    # Double check that the content of the cached file
                    # identifies it as being from the correct saltenv. The
                    # setUp function creates the file with the name of the
                    # saltenv mentioned in the file, so a simple 'in' check is
                    # sufficient here. If opening the file raises an exception,
                    # this is a problem, so we are not catching the exception
                    # and letting it be raised so that the test fails.
                    with salt.utils.fopen(cache_loc) as fp_:
                        content = fp_.read()
                    log.debug('cache_loc = %s', cache_loc)
                    log.debug('content = %s', content)
                    self.assertTrue(subdir_file in content)
                    self.assertTrue(SUBDIR in content)
                    self.assertTrue(saltenv in content)
Build a color representation from the string representation of an object
dataset/ETHPy150Open saltstack/salt/tests/integration/fileclient_test.py/FileclientTest.test_cache_dir_with_alternate_cachedir_and_relative_path--crossover with--dataset/ETHPy150Open vaab/colour/colour.py/RGB_color_picker