Skip to content

Commit

Permalink
Remove db_ from arango tests so we can search for db_name.
Browse files Browse the repository at this point in the history
  • Loading branch information
tillahoffmann committed Feb 18, 2023
1 parent 6dc9b8d commit 76a9bfa
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions arangodb/tests/test_arangodb.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,22 @@
ARANGODB_IMAGE_NAME = 'arangodb'


def arango_test_ops(arango_client, expeced_version, username='root', db_pass=''):
def arango_test_ops(arango_client, expeced_version, username='root', password=''):
"""
Basic ArangoDB operations to test DB really up and running.
"""
students_to_insert_cnt = 3

# Taken from https://github.com/ArangoDB-Community/python-arango/blob/main/README.md
# Connect to "_system" database as root user.
sys_db = arango_client.db("_system", username=username, password=db_pass)
sys_db = arango_client.db("_system", username=username, password=password)
assert sys_db.version() == expeced_version

# Create a new database named "test".
sys_db.create_database("test")

# Connect to "test" database as root user.
database = arango_client.db("test", username=username, password=db_pass)
database = arango_client.db("test", username=username, password=password)

# Create a new collection named "students".
students = database.create_collection("students")
Expand All @@ -50,7 +50,7 @@ def test_docker_run_arango():
"""
image_version = '3.9.1'
image = f'{ARANGODB_IMAGE_NAME}:{image_version}'
arango_db_root_password = 'passwd'
arango_root_password = 'passwd'

with ArangoDbContainer(image) as arango:
client = ArangoClient(hosts=arango.get_connection_url())
Expand All @@ -63,7 +63,7 @@ def test_docker_run_arango():
arango_test_ops(
arango_client=client,
expeced_version=image_version,
db_pass=arango_db_root_password)
password=arango_root_password)


def test_docker_run_arango_without_auth():
Expand All @@ -79,7 +79,7 @@ def test_docker_run_arango_without_auth():
arango_test_ops(
arango_client=client,
expeced_version=image_version,
db_pass='')
password='')


def test_docker_run_arango_older_version():
Expand All @@ -100,7 +100,7 @@ def test_docker_run_arango_older_version():
arango_test_ops(
arango_client=client,
expeced_version=image_version,
db_pass='')
password='')


def test_docker_run_arango_random_root_password():
Expand All @@ -109,12 +109,12 @@ def test_docker_run_arango_random_root_password():
"""
image_version = '3.9.1'
image = f'{ARANGODB_IMAGE_NAME}:{image_version}'
arango_db_root_password = 'passwd'
arango_root_password = 'passwd'

with ArangoDbContainer(image, arango_random_root_password=True) as arango:
client = ArangoClient(hosts=arango.get_connection_url())

# Test invalid auth (we don't know the password in random mode)
with pytest.raises(ServerVersionError):
sys_db = client.db("_system", username='root', password=arango_db_root_password)
sys_db = client.db("_system", username='root', password=arango_root_password)
assert sys_db.version() == image_version

0 comments on commit 76a9bfa

Please sign in to comment.