mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-08 20:21:04 +00:00
example: Add coap_client example_test
This commit is contained in:
21
examples/protocols/coap_client/pytest_coap_client_example.py
Normal file
21
examples/protocols/coap_client/pytest_coap_client_example.py
Normal file
@@ -0,0 +1,21 @@
|
||||
# SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: Unlicense OR CC0-1.0
|
||||
import pexpect
|
||||
import pytest
|
||||
from pytest_embedded import Dut
|
||||
|
||||
|
||||
@pytest.mark.esp32
|
||||
@pytest.mark.ethernet
|
||||
def test_coap_example(dut: Dut) -> None:
|
||||
dut.expect('Loaded app from partition at offset', timeout=30)
|
||||
try:
|
||||
dut.expect(r'IPv4 address: (\d+\.\d+\.\d+\.\d+)[^\d]', timeout=30)
|
||||
except pexpect.exceptions.TIMEOUT:
|
||||
raise ValueError('ENV_TEST_FAILURE: Cannot connect to AP/Ethernet')
|
||||
|
||||
dut.expect('DNS lookup succeeded', timeout=30)
|
||||
dut.expect('Received', timeout=30)
|
||||
dut.expect(r'This server is using the Eclipse Californium \(Cf\) CoAP framework', timeout=30)
|
||||
dut.expect(r'published under EPL\+EDL: http://www\.eclipse\.org/californium/', timeout=30)
|
||||
dut.expect('Starting again!', timeout=30)
|
Reference in New Issue
Block a user