def test_wpacli_set_device_name(monkeypatch): def mockreturn(self, *arg): assert arg == ( "set", "device_name", "foo", ) return "OK" monkeypatch.setattr(WpaCli, "cmd", mockreturn) wpacli = WpaCli() wpacli.set_device_name("foo")
def test_wpacli_set_device_name_negative(monkeypatch): def mockreturn(self, *arg): assert arg == ( "set", "device_name", "foo", ) return "FAILED" monkeypatch.setattr(WpaCli, "cmd", mockreturn) wpacli = WpaCli() with pytest.raises(WpaException): wpacli.set_device_name("foo")
def create_p2p_interface(self, R2): wpacli = WpaCli() wpacli.start_p2p_find() wpacli.set_device_name(self.config.device_name) wpacli.set_device_type(self.config.device_type) wpacli.set_p2p_go_ht40() wpacli.wfd_subelem_set(0, self.wfd_devinfo()) wpacli.wfd_subelem_set(1, self.wfd_bssid(0)) wpacli.wfd_subelem_set(6, self.wfd_sink_info(0, 0)) wpacli.wfd_subelem_set(7, self.wfd_ext_cap(uibc=False, i2c=False)) if R2: wpacli.wfd_subelem_set(11, self.wfd_devinfo2()) wpacli.p2p_group_add(self.config.group_name)