示例#1
0
 def test_load_existing_data(self):
     session = sessions.Memcache(timeout=-1)
     session.client = self.mock_memcache
     session.client.get.return_value = None
     session['blah'] = 'test'
     session.load()
     assert session['blah'] is None
示例#2
0
 def test_destroy(self):
     session = sessions.Memcache()
     session.client = self.mock_memcache
     session['test'] = 'blah'
     session.client.get.return_value = 'blah'
     assert session['test'] == 'blah'
     session.destroy()
     assert not session.exists()
示例#3
0
 def test_cookie_params(self):
     session = sessions.Memcache()
     params = {
         'expires': 0,
         'path': '/',
         'domain': None,
         'secure': False,
         'httponly': True,
         'comment': 'Watson session id'
     }
     session.cookie_params = params
     assert session.cookie_params == params
示例#4
0
 def test_close(self):
     session = sessions.Memcache()
     session.client = self.mock_memcache
     assert session.close()
示例#5
0
 def test_exists(self):
     session = sessions.Memcache()
     session.client = self.mock_memcache
     session.client.get.return_value = None
     assert not session.exists()
示例#6
0
 def test_load(self):
     session = sessions.Memcache()
     session.client = self.mock_memcache
     session.client.get.return_value = {}
     session.load()
     assert not session.data
示例#7
0
 def test_data(self):
     session = sessions.Memcache()
     assert session.data is None
示例#8
0
 def test_open_connection(self):
     session = sessions.Memcache()
     session.open()
示例#9
0
 def test_create(self):
     session = sessions.Memcache(id=123, timeout=30, autosave=False)
     assert session.autosave is False
     assert session.timeout == 30
     assert session.id == 123