pytest_https_x509_bundle.py 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. # SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
  2. # SPDX-License-Identifier: Unlicense OR CC0-1.0
  3. import logging
  4. import os
  5. import pytest
  6. from pytest_embedded import Dut
  7. @pytest.mark.esp32
  8. @pytest.mark.esp32c3
  9. @pytest.mark.esp32s2
  10. @pytest.mark.esp32s3
  11. @pytest.mark.wifi
  12. def test_examples_protocol_https_x509_bundle(dut: Dut) -> None:
  13. """
  14. steps: |
  15. 1. join AP
  16. 2. connect to multiple URLs
  17. 3. send http request
  18. """
  19. # check and log bin size
  20. binary_file = os.path.join(dut.app.binary_path, 'https_x509_bundle.bin')
  21. bin_size = os.path.getsize(binary_file)
  22. logging.info('https_x509_bundle_bin_size : {}KB'.format(bin_size // 1024))
  23. # start test
  24. num_URLS = int(dut.expect(r'Connecting to (\d+) URLs', timeout=30)[1].decode())
  25. dut.expect(r'Connection established to ([\s\S]*)', timeout=30)
  26. dut.expect('Completed {} connections'.format(num_URLS), timeout=60)
  27. @pytest.mark.esp32
  28. @pytest.mark.esp32c3
  29. @pytest.mark.esp32s2
  30. @pytest.mark.esp32s3
  31. @pytest.mark.wifi
  32. @pytest.mark.parametrize('config', ['ssldyn',], indirect=True)
  33. def test_examples_protocol_https_x509_bundle_dynamic_buffer(dut: Dut) -> None:
  34. # test mbedtls dynamic resource
  35. # check and log bin size
  36. binary_file = os.path.join(dut.app.binary_path, 'https_x509_bundle.bin')
  37. bin_size = os.path.getsize(binary_file)
  38. logging.info('https_x509_bundle_bin_size : {}KB'.format(bin_size // 1024))
  39. # start test
  40. num_URLS = int(dut.expect(r'Connecting to (\d+) URLs', timeout=30)[1].decode())
  41. dut.expect(r'Connection established to ([\s\S]*)', timeout=30)
  42. dut.expect('Completed {} connections'.format(num_URLS), timeout=60)