pytest_coap_client_example.py 855 B

123456789101112131415161718192021
  1. # SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
  2. # SPDX-License-Identifier: Unlicense OR CC0-1.0
  3. import pexpect
  4. import pytest
  5. from pytest_embedded import Dut
  6. @pytest.mark.esp32
  7. @pytest.mark.ethernet
  8. def test_coap_example(dut: Dut) -> None:
  9. dut.expect('Loaded app from partition at offset', timeout=30)
  10. try:
  11. dut.expect(r'IPv4 address: (\d+\.\d+\.\d+\.\d+)[^\d]', timeout=30)
  12. except pexpect.exceptions.TIMEOUT:
  13. raise ValueError('ENV_TEST_FAILURE: Cannot connect to AP/Ethernet')
  14. dut.expect('DNS lookup succeeded', timeout=30)
  15. dut.expect('Received', timeout=30)
  16. dut.expect(r'This server is using the Eclipse Californium \(Cf\) CoAP framework', timeout=30)
  17. dut.expect(r'published under EPL\+EDL: http://www\.eclipse\.org/californium/', timeout=30)
  18. dut.expect('Starting again!', timeout=30)