def test_deletes(contacts_provider, contact_sync, db): num_original_contacts = db.session.query(Contact).count() contacts_provider.supply_contact('Name', '*****@*****.**') contact_sync.provider = contacts_provider contact_sync.sync() num_current_contacts = db.session.query(Contact).count() assert num_current_contacts - num_original_contacts == 1 contacts_provider.__init__() contacts_provider.supply_contact(None, None, deleted=True) contact_sync.sync() num_current_contacts = db.session.query(Contact).count() assert num_current_contacts == num_original_contacts
def test_update_contact(contacts_provider, contact_sync, db): """Test that subsequent contact updates get stored.""" contacts_provider.supply_contact('Old Name', '*****@*****.**') contact_sync.provider = contacts_provider contact_sync.sync() results = db.session.query(Contact).all() email_addresses = [r.email_address for r in results] assert '*****@*****.**' in email_addresses contacts_provider.__init__() contacts_provider.supply_contact('New Name', '*****@*****.**') contact_sync.sync() db.session.commit() results = db.session.query(Contact).all() names = [r.name for r in results] assert 'New Name' in names email_addresses = [r.email_address for r in results] assert '*****@*****.**' in email_addresses