def test_addAddress(self): """ Test that L{smtpout.FromAddressConfigFragment.addAddress} creates L{smtpout.FromAddress} items with the right attribute values """ attrs = dict(address=u'foo@bar', smtpHost=u'bar', smtpUsername=u'foo', smtpPort=25, smtpPassword=u'secret') self.frag.addAddress(default=False, **attrs) item = self.store.findUnique(smtpout.FromAddress, smtpout.FromAddress._default == False) for (k, v) in attrs.iteritems(): self.assertEquals(getattr(item, k), v) item.deleteFromStore() self.frag.addAddress(default=True, **attrs) item = self.store.findUnique(smtpout.FromAddress, smtpout.FromAddress._default == True) for (k, v) in attrs.iteritems(): self.assertEquals(getattr(item, k), v) # make sure it did self.assertEquals(smtpout.FromAddress.findDefault(self.store), item)
def api_removeItem(self, request): """ Removes the item {id} from the database. """ item = self.api_getItem(request) # Cleanup if (source.IPubSubEventProcessor.providedBy(item)): self.pubsubDispatcher.removeObserver(item) if hasattr(item, 'terms') and hasattr(item, 'userIDs'): self.twitterDispatcher.refreshFilters() item.deleteFromStore(True) return {"status": "deleted"}
def delete(item): item.deleteFromStore()
def action_delete(self, item): """ Delete the given L{FromAddress} """ item.deleteFromStore()