Exemplo n.º 1
0
    def setUp(self):
        super().setUp()

        self.switchboard = mock.MagicMock(spec=switchboard.SwitchboardDefault)
        self.button_map = {
            "a_button": {
                "interface": 1,
                "pin": 3
            },
            "b_button": {
                "interface": 2,
                "pin": 5
            }
        }
        with mock.patch.object(ftdi_buttons.FtdiButtons,
                               "bitbang_device_init"):
            self.switchboard.button_list = [
                ftdi_buttons.FtdiButtons(ftdi_serial_number="12345678",
                                         button_map=self.button_map)
            ]
        self.device_log_file = "some_file.txt"
        self.config = console_config.get_log_response_separate_port_configuration(
            line_identifier.PortLogIdentifier())

        self.uut = console.ConsoleApp(self.switchboard, self.device_log_file,
                                      self.config)
Exemplo n.º 2
0
    def test_004_port_log_identifier(self):
        """Test LogResponseIdentifier class accepts all lines."""
        log_ports = [1]
        uut = line_identifier.PortLogIdentifier(log_ports)
        reject_inputs = [[0, "", TYPE_LOG], [1, "", TYPE_RESPONSE]]
        accept_inputs = [[1, "", TYPE_LOG], [0, "", TYPE_RESPONSE],
                         [1, "", TYPE_ALL], [0, "", TYPE_ALL]]

        self._test_state_machine(uut, "PortLogIdentifier", reject_inputs,
                                 accept_inputs)
Exemplo n.º 3
0
    def test_000_line_identifier_construct_destruct(self):
        """Test constructing and destructing of LineIdentifier classes."""
        uut2 = line_identifier.AllLogIdentifier()
        del uut2

        uut3 = line_identifier.RegexLogIdentifier("")
        del uut3

        uut4 = line_identifier.PortLogIdentifier()
        del uut4

        uut5 = line_identifier.AllResponseIdentifier()
        del uut5

        uut6 = line_identifier.AllUnknownIdentifier()
        del uut6

        uut7 = line_identifier.MultiportIdentifier([
            line_identifier.AllResponseIdentifier(),
            line_identifier.AllUnknownIdentifier()
        ])
        del uut7
Exemplo n.º 4
0
 def get_identifier(self):
     return line_identifier.PortLogIdentifier(log_ports=[1])
Exemplo n.º 5
0
 def get_identifier(self):
     return line_identifier.PortLogIdentifier()
Exemplo n.º 6
0
 def get_identifier(self) -> line_identifier.LineIdentifier:
     return line_identifier.PortLogIdentifier(log_ports=[1, 2])