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
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))
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
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')
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')
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')
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')