Mercurial > p > roundup > code
view test/session_common.py @ 5098:99e289359798
issue2550803: Replying to NOSY mail goes to the tracker through
reply-to, not original message author.
Created new [tracker] replyto_address config.ini option to allow:
1) setting reply-to header to the tracker
2) setting reply-to header to the address of the author
of the change
3) setting it to a fixed address (like noreply@some.place)
Proposal by Peter Funk (pefu) in discussion with Tom Ekberg
(tekberg).
I chose to re-retrieve the email address for the author from the
database rather than adding a new variable. Also managed to make
a test case for each of the three settings.
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Sun, 26 Jun 2016 00:36:23 -0400 |
| parents | 63c79c0992ae |
| children | 62de601bdf6f |
line wrap: on
line source
import os, shutil, unittest from db_test_base import config class SessionTest(object): def setUp(self): # remove previous test, ignore errors if os.path.exists(config.DATABASE): shutil.rmtree(config.DATABASE) os.makedirs(config.DATABASE + '/files') self.db = self.module.Database(config, 'admin') self.sessions = self.sessions_module.Sessions(self.db) self.otks = self.sessions_module.OneTimeKeys(self.db) def tearDown(self): del self.otks del self.sessions if hasattr(self, 'db'): self.db.close() if os.path.exists(config.DATABASE): shutil.rmtree(config.DATABASE) def testList(self): self.sessions.list() self.sessions.set('random_key', text='hello, world!') self.sessions.list() def testGetAll(self): self.sessions.set('random_key', text='hello, world!') self.assertEqual(self.sessions.getall('random_key'), {'text': 'hello, world!'}) def testDestroy(self): self.sessions.set('random_key', text='hello, world!') self.assertEquals(self.sessions.getall('random_key'), {'text': 'hello, world!'}) self.sessions.destroy('random_key') self.assertRaises(KeyError, self.sessions.getall, 'random_key') def testSetSession(self): self.sessions.set('random_key', text='hello, world!') self.assertEqual(self.sessions.get('random_key', 'text'), 'hello, world!') def testUpdateSession(self): self.sessions.set('random_key', text='hello, world!') self.assertEqual(self.sessions.get('random_key', 'text'), 'hello, world!') self.sessions.set('random_key', text='nope') self.assertEqual(self.sessions.get('random_key', 'text'), 'nope') class DBMTest(SessionTest): import roundup.backends.sessions_dbm as sessions_module class RDBMSTest(SessionTest): import roundup.backends.sessions_rdbms as sessions_module
