Skip to content

Commit

Permalink
add cancellation test for nacked handler as well
Browse files Browse the repository at this point in the history
  • Loading branch information
robamu committed Dec 13, 2023
1 parent 86919bc commit e713b60
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions tests/cfdp/test_dest_handler_naked.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,37 @@ def test_check_timer_mechanism(self):
TransactionStep.IDLE,
)

def test_cancelled_transfer(self):
data = "Hello World\n".encode()
with open(self.src_file_path, "wb") as of:
of.write(data)
file_size = self.src_file_path.stat().st_size
self._generic_regular_transfer_init(
file_size=file_size,
)
self._insert_file_segment(segment=data, offset=0)
# Cancel the transfer by sending an EOF PDU with the appropriate parameters.
eof_pdu = EofPdu(
file_size=0,
file_checksum=NULL_CHECKSUM_U32,
pdu_conf=self.src_pdu_conf,
condition_code=ConditionCode.CANCEL_REQUEST_RECEIVED,
)
self.dest_handler.insert_packet(eof_pdu)
fsm_res = self.dest_handler.state_machine()
self._generic_eof_recv_indication_check(fsm_res)
if self.closure_requested:
self._generic_no_error_finished_pdu_check(fsm_res)
self._generic_verify_transfer_completion(
fsm_res,
expected_file_data=None,
expected_finished_params=FinishedParams(
condition_code=ConditionCode.CANCEL_REQUEST_RECEIVED,
delivery_code=DeliveryCode.DATA_INCOMPLETE,
file_status=FileStatus.FILE_RETAINED,
),
)

def test_check_limit_reached(self):
data = "Hello World\n".encode()
self._generic_check_limit_test(data)
Expand Down

0 comments on commit e713b60

Please sign in to comment.