Beispiel #1
0
 def test_set(self):
     self.app.conf.couchbase_backend_settings = None
     x = CouchbaseBackend(app=self.app)
     x._connection = MagicMock()
     x._connection.set = MagicMock()
     # should return None
     assert x.set(sentinel.key, sentinel.value) is None
Beispiel #2
0
 def test_set(self):
     self.app.conf.couchbase_backend_settings = None
     x = CouchbaseBackend(app=self.app)
     x._connection = MagicMock()
     x._connection.set = MagicMock()
     # should return None
     self.assertIsNone(x.set(sentinel.key, sentinel.value))
Beispiel #3
0
 def test_set_expires(self):
     self.app.conf.couchbase_backend_settings = None
     x = CouchbaseBackend(app=self.app, expires=30)
     assert x.expires == 30
     x._connection = MagicMock()
     x._connection.set = MagicMock()
     # should return None
     assert x.set(sentinel.key, sentinel.value, states.SUCCESS) is None
Beispiel #4
0
 def test_delete(self):
     self.app.conf.couchbase_backend_settings = {}
     x = CouchbaseBackend(app=self.app)
     x._connection = Mock()
     mocked_delete = x._connection.delete = Mock()
     mocked_delete.return_value = None
     # should return None
     assert x.delete('1f3fab') is None
     x._connection.delete.assert_called_once_with('1f3fab')
Beispiel #5
0
 def test_get(self):
     self.app.conf.couchbase_backend_settings = {}
     x = CouchbaseBackend(app=self.app)
     x._connection = Mock()
     mocked_get = x._connection.get = Mock()
     mocked_get.return_value.value = sentinel.retval
     # should return None
     assert x.get('1f3fab') == sentinel.retval
     x._connection.get.assert_called_once_with('1f3fab')
Beispiel #6
0
 def test_delete(self):
     self.app.conf.couchbase_backend_settings = {}
     x = CouchbaseBackend(app=self.app)
     x._connection = Mock()
     mocked_delete = x._connection.delete = Mock()
     mocked_delete.return_value = None
     # should return None
     self.assertIsNone(x.delete('1f3fab'))
     x._connection.delete.assert_called_once_with('1f3fab')
Beispiel #7
0
 def test_get(self):
     self.app.conf.couchbase_backend_settings = {}
     x = CouchbaseBackend(app=self.app)
     x._connection = Mock()
     mocked_get = x._connection.get = Mock()
     mocked_get.return_value.value = sentinel.retval
     # should return None
     self.assertEqual(x.get('1f3fab'), sentinel.retval)
     x._connection.get.assert_called_once_with('1f3fab')