<commit_before>import sys
if (sys.version_info >= (2, 7)):
    import unittest
else:
    import unittest2 as unittest
from resource_suite import ResourceBase
from pydevtest_common import assertiCmd, assertiCmdFail, interruptiCmd
import pydevtest_sessions as s
import commands
import os
import shlex
import datetime
import time


class Test_CatalogSuite(unittest.TestCase, ResourceBase):

    my_test_resource = {"setup": [], "teardown": []}

    def setUp(self):
        ResourceBase.__init__(self)
        s.twousers_up()
        self.run_resource_setup()

    def tearDown(self):
        self.run_resource_teardown()
        s.twousers_down()

    ###################
    # icd
    ###################

    def test_empty_icd(self):
        # assertions
        assertiCmd(s.adminsession, "ils -L", "LIST", "test")  # whatever
        assertiCmd(s.adminsession, "icd " + self.testdir)  # get into subdir
        assertiCmd(s.adminsession, "icd")  # just go home
        assertiCmd(s.adminsession, "ils", "LIST", "/" + s.adminsession.get_zone_name() +
                   "/home/" + s.adminsession.get_username() + ":")  # listing

    def test_empty_icd_verbose(self):
        # assertions
        assertiCmd(s.adminsession, "icd " + self.testdir)  # get into subdir
        assertiCmd(s.adminsession, "icd -v", "LIST", "Deleting (if it exists) session envFile:")  # home, verbose
        assertiCmd(s.adminsession, "ils", "LIST", "/" + s.adminsession.get_zone_name() +
                   "/home/" + s.adminsession.get_username() + ":")  # listing

    def test_icd_to_subdir(self):
        # assertions
        assertiCmd(s.adminsession, "icd " + self.testdir)  # get into subdir
        assertiCmd(s.adminsession, "ils", "LIST", "/" + s.adminsession.get_zone_name() + "/home/" +
                   s.adminsession.get_username() + "/" + s.adminsession._session_id + "/" + self.testdir + ":")  # listing

    def test_icd_to_parentdir(self):
        # assertions
        assertiCmd(s.adminsession, "icd ..")  # go to parent
        assertiCmd(s.adminsession, "ils", "LIST", "/" + s.adminsession.get_zone_name() +
                   "/home/" + s.adminsession.get_username() + ":")  # listing

    def test_icd_to_root(self):
        # assertions
        assertiCmd(s.adminsession, "icd /")  # go to root
        assertiCmd(s.adminsession, "ils", "LIST", "/:")  # listing

    def test_icd_to_root_with_badpath(self):
        # assertions
        # go to root with bad path
        assertiCmd(s.adminsession, "icd /doesnotexist", "LIST", "No such directory (collection):")

    ###################
    # iexit
    ###################

    def test_iexit(self):
        # assertions
        assertiCmd(s.adminsession, "iexit")  # just go home

    def test_iexit_verbose(self):
        # assertions
        assertiCmd(s.adminsession, "iexit -v", "LIST", "Deleting (if it exists) session envFile:")  # home, verbose

    def test_iexit_with_bad_option(self):
        # assertions
        assertiCmdFail(s.adminsession, "iexit -z")  # run iexit with bad option

    def test_iexit_with_bad_parameter(self):
        # assertions
        assertiCmdFail(s.adminsession, "iexit badparameter")  # run iexit with bad parameter

    ###################
    # ihelp
    ###################

    def test_local_ihelp(self):
        # assertions
        assertiCmd(s.adminsession, "ihelp", "LIST", "The following is a list of the icommands")  # run ihelp

    def test_local_ihelp_with_help(self):
        # assertions
        assertiCmd(s.adminsession, "ihelp -h", "LIST", "Display i-commands synopsis")  # run ihelp with help

    def test_local_ihelp_all(self):
        # assertions
        assertiCmd(s.adminsession, "ihelp -a", "LIST", "Usage")  # run ihelp on all icommands

    def test_local_ihelp_with_good_icommand(self):
        # assertions
        assertiCmd(s.adminsession, "ihelp ils", "LIST", "Usage")  # run ihelp with good icommand

    def test_local_ihelp_with_bad_icommand(self):
        # assertions
        assertiCmdFail(s.adminsession, "ihelp idoesnotexist")  # run ihelp with bad icommand

    def test_local_ihelp_with_bad_option(self):
        # assertions
        assertiCmdFail(s.adminsession, "ihelp -z")  # run ihelp with bad option

    ###################
    # imkdir
    ###################

    def test_local_imkdir(self):
        # local setup
        mytestdir = "testingimkdir"
        # assertions
        assertiCmdFail(s.adminsession, "ils -L " + mytestdir, "LIST", mytestdir)  # should not be listed
        assertiCmd(s.adminsession, "imkdir " + mytestdir)  # imkdir<commit_msg>[#858] ihelp output message changed<commit_after>import sys
if (sys.version_info >= (2, 7)):
    import unittest
else:
    import unittest2 as unittest
from resource_suite import ResourceBase
from pydevtest_common import assertiCmd, assertiCmdFail, interruptiCmd
import pydevtest_sessions as s
import commands
import os
import shlex
import datetime
import time


class Test_CatalogSuite(unittest.TestCase, ResourceBase):

    my_test_resource = {"setup": [], "teardown": []}

    def setUp(self):
        ResourceBase.__init__(self)
        s.twousers_up()
        self.run_resource_setup()

    def tearDown(self):
        self.run_resource_teardown()
        s.twousers_down()

    ###################
    # icd
    ###################

    def test_empty_icd(self):
        # assertions
        assertiCmd(s.adminsession, "ils -L", "LIST", "test")  # whatever
        assertiCmd(s.adminsession, "icd " + self.testdir)  # get into subdir
        assertiCmd(s.adminsession, "icd")  # just go home
        assertiCmd(s.adminsession, "ils", "LIST", "/" + s.adminsession.get_zone_name() +
                   "/home/" + s.adminsession.get_username() + ":")  # listing

    def test_empty_icd_verbose(self):
        # assertions
        assertiCmd(s.adminsession, "icd " + self.testdir)  # get into subdir
        assertiCmd(s.adminsession, "icd -v", "LIST", "Deleting (if it exists) session envFile:")  # home, verbose
        assertiCmd(s.adminsession, "ils", "LIST", "/" + s.adminsession.get_zone_name() +
                   "/home/" + s.adminsession.get_username() + ":")  # listing

    def test_icd_to_subdir(self):
        # assertions
        assertiCmd(s.adminsession, "icd " + self.testdir)  # get into subdir
        assertiCmd(s.adminsession, "ils", "LIST", "/" + s.adminsession.get_zone_name() + "/home/" +
                   s.adminsession.get_username() + "/" + s.adminsession._session_id + "/" + self.testdir + ":")  # listing

    def test_icd_to_parentdir(self):
        # assertions
        assertiCmd(s.adminsession, "icd ..")  # go to parent
        assertiCmd(s.adminsession, "ils", "LIST", "/" + s.adminsession.get_zone_name() +
                   "/home/" + s.adminsession.get_username() + ":")  # listing

    def test_icd_to_root(self):
        # assertions
        assertiCmd(s.adminsession, "icd /")  # go to root
        assertiCmd(s.adminsession, "ils", "LIST", "/:")  # listing

    def test_icd_to_root_with_badpath(self):
        # assertions
        # go to root with bad path
        assertiCmd(s.adminsession, "icd /doesnotexist", "LIST", "No such directory (collection):")

    ###################
    # iexit
    ###################

    def test_iexit(self):
        # assertions
        assertiCmd(s.adminsession, "iexit")  # just go home

    def test_iexit_verbose(self):
        # assertions
        assertiCmd(s.adminsession, "iexit -v", "LIST", "Deleting (if it exists) session envFile:")  # home, verbose

    def test_iexit_with_bad_option(self):
        # assertions
        assertiCmdFail(s.adminsession, "iexit -z")  # run iexit with bad option

    def test_iexit_with_bad_parameter(self):
        # assertions
        assertiCmdFail(s.adminsession, "iexit badparameter")  # run iexit with bad parameter

    ###################
    # ihelp
    ###################

    def test_local_ihelp(self):
        assertiCmd(s.adminsession, 'ihelp', 'STDOUT', 'The iCommands and a brief description of each:')

    def test_local_ihelp_with_help(self):
        # assertions
        assertiCmd(s.adminsession, "ihelp -h", "LIST", "Display i-commands synopsis")  # run ihelp with help

    def test_local_ihelp_all(self):
        # assertions
        assertiCmd(s.adminsession, "ihelp -a", "LIST", "Usage")  # run ihelp on all icommands

    def test_local_ihelp_with_good_icommand(self):
        # assertions
        assertiCmd(s.adminsession, "ihelp ils", "LIST", "Usage")  # run ihelp with good icommand

    def test_local_ihelp_with_bad_icommand(self):
        # assertions
        assertiCmdFail(s.adminsession, "ihelp idoesnotexist")  # run ihelp with bad icommand

    def test_local_ihelp_with_bad_option(self):
        # assertions
        assertiCmdFail(s.adminsession, "ihelp -z")  # run ihelp with bad option

    ###################
    # imkdir
    ###################

    def test_local_imkdir(self):
        # local setup
        mytestdir = "testingimkdir"
        # assertions
        assertiCmdFail(s.adminsession, "ils -L " + mytestdir, "LIST", mytestdir)  # should not be listed
        assertiCmd(s.adminsession, "imkdir " + mytestdir)  # imkdir
{'fraction_non_alphanumeric': 0.146484375, 'fraction_numerical': 0.0009765625, 'mean_word_length': 2.940572894399316, 'pattern_counts': {'":': 12, '<': 3, '<?xml version=': 0, '>': 5, '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': '4717735', 'n_tokens_mistral': 3151, 'n_tokens_neox': 2981, 'n_words': 634}