<commit_before>from tests.framework.cli_testcase import CliTestCase
from tests.framework.constants import GO_EP1_ID


class LsTests(CliTestCase):
    """
    Tests globus ls command
    """

    def test_path(self):
        """
        Does an ls on EP1:/, confirms expected results.
        """
        path = "/"
        output = self.run_line("globus ls {}:{}".format(GO_EP1_ID, path))

        expected = ["home/", "mnt/", "not shareable/", "share/"]
        for item in expected:
            self.assertIn(item, output)

    def test_recursive(self):
        """
        Confirms --recursive ls on EP1:/share/ finds file1.txt
        """
        output = self.run_line("globus ls -r {}:/share/".format(GO_EP1_ID))
        self.assertIn("file1.txt", output)

    def test_depth(self):
        """
        Confirms setting depth to 1 on a --recursive ls of EP1:/
        finds godata but not file1.txt
        """
        output = self.run_line(("globus ls -r --recursive-depth-limit 1 {}:/"
                                .format(GO_EP1_ID)))
        self.assertNotIn("file1.txt", output)

    def test_recursive_json(self):
        """
        Confirms -F json works with the RecursiveLsResponse
        """
        output = self.run_line("globus ls -r -F json {}:/".format(GO_EP1_ID))
        self.assertIn('"DATA":', output)
        self.assertIn('"name": "share/godata/file1.txt"', output)<commit_msg>Fix concurrency bug in ls tests<commit_after>from tests.framework.cli_testcase import CliTestCase
from tests.framework.constants import GO_EP1_ID


class LsTests(CliTestCase):
    """
    Tests globus ls command
    """

    def test_path(self):
        """
        Does an ls on EP1:/, confirms expected results.
        """
        path = "/"
        output = self.run_line("globus ls {}:{}".format(GO_EP1_ID, path))

        expected = ["home/", "mnt/", "not shareable/", "share/"]
        for item in expected:
            self.assertIn(item, output)

    def test_recursive(self):
        """
        Confirms --recursive ls on EP1:/share/ finds file1.txt
        """
        output = self.run_line("globus ls -r {}:/share/".format(GO_EP1_ID))
        self.assertIn("file1.txt", output)

    def test_depth(self):
        """
        Confirms setting depth to 1 on a --recursive ls of EP1:/
        finds godata but not file1.txt
        """
        output = self.run_line(("globus ls -r --recursive-depth-limit 1 {}:/"
                                .format(GO_EP1_ID)))
        self.assertNotIn("file1.txt", output)

    def test_recursive_json(self):
        """
        Confirms -F json works with the RecursiveLsResponse
        """
        output = self.run_line(
            "globus ls -r -F json {}:/share".format(GO_EP1_ID))
        self.assertIn('"DATA":', output)
        self.assertIn('"name": "godata/file1.txt"', output)
{'fraction_non_alphanumeric': 0.13789473684210526, 'fraction_numerical': 0.010526315789473684, 'mean_word_length': 2.1398678414096914, 'pattern_counts': {'":': 4, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7422898', 'n_tokens_mistral': 954, 'n_tokens_neox': 889, 'n_words': 217}