|
1 | | -# """ |
2 | | -# burnwire_test.py: |
| 1 | +""" |
| 2 | +burnwire_test.py: |
3 | 3 |
|
4 | | -# Integration tests for the Burnwire component. |
5 | | -# """ |
| 4 | +Integration tests for the Burnwire component. |
| 5 | +""" |
6 | 6 |
|
7 | 7 | import pytest |
| 8 | +from common import proves_send_and_assert_command |
8 | 9 | from fprime_gds.common.testing_fw.api import IntegrationTestAPI |
9 | 10 |
|
10 | | -# Constants |
| 11 | +burnwire = "ReferenceDeployment.burnwire" |
11 | 12 |
|
12 | 13 |
|
13 | 14 | @pytest.fixture(autouse=True) |
14 | | -def reset_burnwire(fprime_test_api: IntegrationTestAPI): |
| 15 | +def reset_burnwire(fprime_test_api: IntegrationTestAPI, start_gds): |
15 | 16 | """Fixture to stop burnwire and clear histories before/after each test""" |
16 | 17 | # Stop burnwire and clear before test |
17 | | - fprime_test_api.clear_histories() |
18 | 18 | stop_burnwire(fprime_test_api) |
19 | 19 | yield |
20 | 20 | # Clear again after test to prevent residue |
21 | | - fprime_test_api.clear_histories() |
22 | 21 | stop_burnwire(fprime_test_api) |
23 | 22 |
|
24 | 23 |
|
25 | 24 | def stop_burnwire(fprime_test_api: IntegrationTestAPI): |
26 | | - fprime_test_api.send_and_assert_command( |
27 | | - "ReferenceDeployment.burnwire.STOP_BURNWIRE" |
28 | | - ) |
| 25 | + """Stop the burnwire and clear histories""" |
| 26 | + proves_send_and_assert_command(fprime_test_api, f"{burnwire}.STOP_BURNWIRE") |
29 | 27 |
|
30 | | - fprime_test_api.assert_event( |
31 | | - "ReferenceDeployment.burnwire.SetBurnwireState", "OFF", timeout=10 |
32 | | - ) |
| 28 | + fprime_test_api.assert_event(f"{burnwire}.SetBurnwireState", "OFF", timeout=10) |
33 | 29 |
|
34 | | - fprime_test_api.assert_event( |
35 | | - "ReferenceDeployment.burnwire.BurnwireEndCount", timeout=2 |
36 | | - ) |
37 | | - |
38 | | - received_events = fprime_test_api.get_event_subhistory() |
39 | | - print(f"Received events: {received_events}") |
| 30 | + fprime_test_api.assert_event(f"{burnwire}.BurnwireEndCount", timeout=2) |
40 | 31 |
|
41 | 32 |
|
42 | 33 | def test_01_start_and_stop_burnwire(fprime_test_api: IntegrationTestAPI, start_gds): |
43 | 34 | """Test that burnwire starts and stops as expected""" |
44 | 35 |
|
45 | 36 | # Start burnwire |
46 | | - fprime_test_api.send_and_assert_command( |
47 | | - "ReferenceDeployment.burnwire.START_BURNWIRE" |
48 | | - ) |
| 37 | + proves_send_and_assert_command(fprime_test_api, f"{burnwire}.START_BURNWIRE") |
49 | 38 |
|
50 | 39 | # Wait for SetBurnwireState = ON |
51 | | - fprime_test_api.assert_event( |
52 | | - "ReferenceDeployment.burnwire.SetBurnwireState", "ON", timeout=2 |
53 | | - ) |
| 40 | + fprime_test_api.assert_event(f"{burnwire}.SetBurnwireState", "ON", timeout=2) |
54 | 41 |
|
55 | | - fprime_test_api.assert_event( |
56 | | - "ReferenceDeployment.burnwire.SafetyTimerState", timeout=2 |
57 | | - ) |
| 42 | + fprime_test_api.assert_event(f"{burnwire}.SafetyTimerState", timeout=2) |
58 | 43 |
|
59 | | - fprime_test_api.assert_event( |
60 | | - "ReferenceDeployment.burnwire.SetBurnwireState", "OFF", timeout=10 |
61 | | - ) |
| 44 | + fprime_test_api.assert_event(f"{burnwire}.SetBurnwireState", "OFF", timeout=10) |
62 | 45 |
|
63 | | - fprime_test_api.assert_event( |
64 | | - "ReferenceDeployment.burnwire.BurnwireEndCount", timeout=2 |
65 | | - ) |
| 46 | + fprime_test_api.assert_event(f"{burnwire}.BurnwireEndCount", timeout=2) |
66 | 47 |
|
67 | 48 |
|
68 | 49 | def test_02_manual_stop_before_timeout(fprime_test_api: IntegrationTestAPI, start_gds): |
69 | 50 | """Test that burnwire stops manually before the safety timer expires""" |
70 | 51 |
|
71 | 52 | # Start burnwire |
72 | | - fprime_test_api.send_and_assert_command( |
73 | | - "ReferenceDeployment.burnwire.START_BURNWIRE" |
74 | | - ) |
| 53 | + proves_send_and_assert_command(fprime_test_api, f"{burnwire}.START_BURNWIRE") |
75 | 54 |
|
76 | 55 | # Confirm Burnwire turned ON |
77 | | - fprime_test_api.assert_event( |
78 | | - "ReferenceDeployment.burnwire.SetBurnwireState", "ON", timeout=2 |
79 | | - ) |
| 56 | + fprime_test_api.assert_event(f"{burnwire}.SetBurnwireState", "ON", timeout=2) |
80 | 57 |
|
81 | 58 | # # Stop burnwire before safety timer triggers |
82 | | - fprime_test_api.send_and_assert_command( |
83 | | - "ReferenceDeployment.burnwire.STOP_BURNWIRE" |
84 | | - ) |
| 59 | + proves_send_and_assert_command(fprime_test_api, f"{burnwire}.STOP_BURNWIRE") |
85 | 60 |
|
86 | 61 | # Confirm Burnwire turned OFF |
87 | | - fprime_test_api.assert_event( |
88 | | - "ReferenceDeployment.burnwire.SetBurnwireState", "OFF", timeout=2 |
89 | | - ) |
| 62 | + fprime_test_api.assert_event(f"{burnwire}.SetBurnwireState", "OFF", timeout=2) |
90 | 63 |
|
91 | | - fprime_test_api.assert_event( |
92 | | - "ReferenceDeployment.burnwire.BurnwireEndCount", timeout=2 |
93 | | - ) |
| 64 | + fprime_test_api.assert_event(f"{burnwire}.BurnwireEndCount", timeout=2) |
0 commit comments