Esempio n. 1
0
    def __init__(self):
        self.environ = Environment.Environment(DjangoModelInterface(),
                                               DEBUG=True)
        self.ui = UI.UI(self.environ)

        acct = Account.objects.filter(
            name=self.environ.database.get_logged_in()).first()
        if acct is not None:
            self.environ.user = TaCLI.User.User(acct.name, acct.role)
Esempio n. 2
0
class CommandTests(TestCase):
    def setUp(self):
        di = DjangoModelInterface()
        self.environment = Environment(di, DEBUG=True)
        self.ui = UI(self.environment)

    def test_parse_commands(self):
        self.assertTrue(self.ui.parse_commands("command1 command2 command3"),
                        {"command1", "command2", "command2"})

    def test_command(self):
        self.assertEqual(
            self.ui.command(command="invalid", args="arg arg arg"),
            "Invalid Command")

    def test_valid_command(self):
        self.assertEqual(
            self.ui.command(command="assign_lab", args="361 801 appoorv"),
            "ERROR")
Esempio n. 3
0
    def setUp(self):
        self.di = DjangoModelInterface()

        self.di.create_account("Supervisor", "SupervisorPassword", "supervisor")
        self.di.create_account("Administrator", "AdministratorPassword", "administrator")
        self.di.create_account("Instructor", "InstructorPassword", "instructor")
        self.di.create_account("TA", "TAPassword", "TA")

        self.di.create_course("361", "CompSci361")
        self.di.create_lab("361", "801")

        self.environment = Environment.Environment(self.di, DEBUG=True)
        self.ui = UI.UI(self.environment)
Esempio n. 4
0
    def setUp(self):
        """
            create dummy account for each of the types of users:
            supervisor, administrator, instructor and TA and then
            log them in for their respected tests
        """
        self.di = DjangoModelInterface()

        self.di.create_account("Supervisor", "SupervisorPassword",
                               "supervisor")
        self.di.create_account("Administrator", "AdministratorPassword",
                               "administrator")
        self.di.create_account("Instructor", "InstructorPassword",
                               "instructor")
        self.di.create_account("TA", "TAPassword", "TA")

        self.di.create_course("361", "CompSci361")
        self.di.create_lab("361", "801")

        self.environment = Environment.Environment(self.di, DEBUG=True)
        self.ui = UI.UI(self.environment)
        """
Esempio n. 5
0
 def setUp(self):
     self.di = DjangoModelInterface()
     self.environment = Environment.Environment(self.di, DEBUG=True)
     self.ui = UI.UI(self.environment)
Esempio n. 6
0
 def __init__(self):
     self.environ = Environment.Environment(DjangoModelInterface(),
                                            DEBUG=True)
     self.ui = UI.UI(self.environ)
Esempio n. 7
0
from TaCLI import UI, Environment, TextFileInterface

# create an instance of the UI
environment = Environment.Environment(TextFileInterface.TextFileInterface(),
                                      DEBUG=True)
ui = UI.UI(environment)

# TextFileInterface.TextFileInterface().create_account("tyler", "a", "supervisor")
# create a user to determine if someone is logged onto the system
# if CurrentUser is none: no one is logged on
# if CurrentUser is not None, someone is logged on.

# set application to running
running = True
while running:
    s = input("Enter a command: ")

    # stop and quit application
    if s == "q":
        running = False
    else:
        # take input and attempt to change into a command
        response = ui.command(s)
        print(response)

print("Program has been terminated.")