예제 #1
0
    def test_delete(self):
        """test_delete

        CouchDBBackend.delete should return and take two params
        db conn to pycouchdb is mocked.
        TODO Should test on key not exists

        """
        self.app.conf.CELERY_COUCHDB_BACKEND_SETTINGS = {}
        x = CouchDBBackend(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")
예제 #2
0
    def test_get(self):
        """test_get

        CouchDBBackend.get should return  and take two params
        db conn to couchdb is mocked.
        TODO Should test on key not exists

        """
        self.app.conf.CELERY_COUCHDB_BACKEND_SETTINGS = {}
        x = CouchDBBackend(app=self.app)
        x._connection = Mock()
        mocked_get = x._connection.get = Mock()
        mocked_get.return_value = sentinel.retval
        # should return None
        self.assertEqual(x.get("1f3fab"), sentinel.retval)
        x._connection.get.assert_called_once_with("1f3fab")