コード例 #1
0
 def test_get(self):
     self.app.conf.arangodb_backend_settings = {}
     x = ArangoDbBackend(app=self.app)
     x.get = Mock()
     x.get.return_value = sentinel.retval
     assert x.get('1f3fab') == sentinel.retval
     x.get.assert_called_once_with('1f3fab')
コード例 #2
0
 def test_init_no_arangodb(self):
     prev, module.py_arango_connection = module.py_arango_connection, None
     try:
         with pytest.raises(ImproperlyConfigured):
             ArangoDbBackend(app=self.app)
     finally:
         module.py_arango_connection = prev
コード例 #3
0
 def test_config_params(self):
     self.app.conf.arangodb_backend_settings = {
         'host': 'test.arangodb.com',
         'port': '8529',
         'username': '******',
         'password': '******',
         'database': 'celery_database',
         'collection': 'celery_collection',
         'http_protocol': 'https'
     }
     x = ArangoDbBackend(app=self.app)
     assert x.host == 'test.arangodb.com'
     assert x.port == 8529
     assert x.username == 'johndoe'
     assert x.password == 'mysecret'
     assert x.database == 'celery_database'
     assert x.collection == 'celery_collection'
     assert x.http_protocol == 'https'
     assert x.arangodb_url == 'https://test.arangodb.com:8529'
コード例 #4
0
 def test_delete(self):
     self.app.conf.arangodb_backend_settings = {}
     x = ArangoDbBackend(app=self.app)
     x.delete = Mock()
     x.delete.return_value = None
     assert x.delete('1f3fab') is None
コード例 #5
0
 def test_init_settings_is_None(self):
     self.app.conf.arangodb_backend_settings = None
     ArangoDbBackend(app=self.app)
コード例 #6
0
 def test_init_no_settings(self):
     self.app.conf.arangodb_backend_settings = []
     with pytest.raises(ImproperlyConfigured):
         ArangoDbBackend(app=self.app)
コード例 #7
0
 def setup(self):
     self.backend = ArangoDbBackend(app=self.app)