def test_setCommand(test_input, view):
    systemCommands(test_input, view)

    cmd = test_input.split()
    if len(cmd) == 3:
        assert view.cfg.get(cmd[1]) == cmd[2]
    else:
        assert view.cfg.deep_get(cmd[1], cmd[2]) == cmd[3]
    def routeCommand(self, cmd):
        self.preCommand()

        log.debug(cmd)

        if cmd.split()[0] not in self.command_set:
            return
        elif cmd.split()[0] in SystemCommandList:
            systemCommands(cmd, self.uvm)
        else:
            try:
                command_scope = self.command_map[str(self.uvm.currFocusView.site)]
            except KeyError as e:
                log.debug(f"command does not exist {e}")
            else:
                command_scope(cmd, self.uvm)

        self.postCommand()
def test_quit(test_input, view):
    with pytest.raises(SystemExit) as wrapped_e:
        systemCommands(test_input, view)
    assert wrapped_e.type == SystemExit
def test_view(test_input, expected, view):
    systemCommands(test_input, view)
    assert type(view.currFocusView.frame) == expected[1]
def test_addReddit(test_input, expected, view):
    systemCommands(test_input, view)
    result = all(ex in view.cfg.deep_get(SITE.REDDIT, 'boards')
                 for ex in expected)
    assert result
def test_addChan(test_input, expected, view):
    systemCommands(test_input, view)
    result = all(ex in view.cfg.deep_get(SITE.FCHAN, 'boards')
                 for ex in expected)
    assert result
def test_search(cmd, search, expected, view):
    systemCommands(cmd[0], view)
    systemCommands(cmd[1], view)
    systemCommands(search, view)
    assert type(view.currFocusView.frame) == expected[1]
def test_hist(cmd, history, expected, view):
    systemCommands(cmd[0], view)
    systemCommands(cmd[1], view)
    systemCommands(history, view)
    assert type(view.currFocusView.frame) == expected[1]
def test_source(source, expected, view, write_source_files):
    systemCommands(source, view)
    assert type(view.currFocusView.frame) == expected[1]