def remove_bank_member( banks_table: BanksTable, bank_member_id: str, ): """ Remove bank member. Marks the member as removed and all its signals are removed from the GSI used to build HMA indexes. NOTE: If we ever start incremental updates to HMA indexes, removing bank members will stop working. """ banks_table.remove_bank_member_signals_to_process( bank_member_id=bank_member_id) banks_table.remove_bank_member(bank_member_id=bank_member_id)
def test_bank_member_removes(self): with self.fresh_dynamodb(): table_manager = BanksTable(self.get_table()) bank_id, bank_member_id = self._create_bank_and_bank_member() bank_member_signal_1 = table_manager.add_bank_member_signal( bank_id=bank_id, bank_member_id=bank_member_id, signal_type=VideoTmkPdqfSignal, signal_value="A VIDEO TMK PDQF SIGNAL. WILTY?", ) bank_member_signal_2 = table_manager.add_bank_member_signal( bank_id=bank_id, bank_member_id=bank_member_id, signal_type=VideoTmkPdqfSignal, signal_value="ANOTHER VIDEO TMK PDQF SIGNAL. WILTY?", ) bank_member_signal_3 = table_manager.add_bank_member_signal( bank_id=bank_id, bank_member_id=bank_member_id, signal_type=VideoTmkPdqfSignal, signal_value="An ANOTHER VIDEO TMK PDQF SIGNAL. WILTY?", ) # expect this to now be available to process to_process = table_manager.get_bank_member_signals_to_process_page( signal_type=VideoTmkPdqfSignal) self.assertEqual(len(to_process.items), 3) table_manager.remove_bank_member_signals_to_process( bank_member_id=bank_member_id) # expect this to now be available to process to_process = table_manager.get_bank_member_signals_to_process_page( signal_type=VideoTmkPdqfSignal) self.assertEqual(len(to_process.items), 0)