

def test_add_flag(self):
    from tinymail.account import folder_updated
    fol1 = self.account.get_folder('fol1')
    with mock_worker(**self.imap_data) as worker:
        with listen_for(folder_updated) as caught_signals:
            fol1.change_flag([4, 15], 'add', '\\Seen')
    event_data = {
        'added': [],
        'removed': [],
        'flags_changed': [4, 15],
    }
    self.assertEqual(caught_signals, [(fol1, event_data)])
    worker.change_flag.assert_called_once_with([4, 15], 'add', '\\Seen')
    caught_signals.assertEqual(fol1.get_message(4).flags, set(['\\Seen']))
    self.assertEqual(fol1.get_message(15).flags, set(['\\Seen', '\\Flagged']))
    accountB = _account_for_test(db=self.db)
    fol1B = accountB.get_folder('fol1')
    self.assertEqual(fol1B.get_message(4).flags, set(['\\Seen']))
    self.assertEqual(fol1B.get_message(15).flags, set(['\\Seen', '\\Flagged']))

dataset/ETHPy150Open mgax/tinymail/src/tinymail/tests/test_account.py ModifyFlagsTest.test_add_flag/VarMisuse@127/181 `self`->`caught_signals`