Skip to content

Commit

Permalink
chore: ruff format
Browse files Browse the repository at this point in the history
  • Loading branch information
tanmoysrt committed Oct 21, 2024
1 parent 1f4fddf commit e7aeb4e
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions agent/tests/test_database.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ class DatabaseTestInstance:
# Test database instance with few utility functions
def __init__(self) -> None:
self.db_root_password = "123456"
self.db_container = MySqlContainer(
image="mysql:8.0", MYSQL_ROOT_PASSWORD=self.db_root_password
)
self.db_container = MySqlContainer(image="mysql:8.0", MYSQL_ROOT_PASSWORD=self.db_root_password)
self.db_container.start()

@property
Expand Down Expand Up @@ -46,9 +44,7 @@ def create_database_user(self, db_name: str, username: str, password: str):
"FLUSH PRIVILEGES",
]
for query in queries:
command = (
f'mysql -h 127.0.0.1 -uroot -p{self.db_root_password} -e "{query}"'
)
command = f'mysql -h 127.0.0.1 -uroot -p{self.db_root_password} -e "{query}"'
self.execute_cmd(command)


Expand Down Expand Up @@ -94,15 +90,11 @@ def tearDown(self) -> None:
self.instance.destroy()

def _db(self, db_name: str, username: str, password: str) -> Database:
return Database(
self.instance.host, self.instance.port, username, password, db_name
)
return Database(self.instance.host, self.instance.port, username, password, db_name)

def test_execute_query(self):
"""Basic test for `execute_query` function"""
db = self._db(self.db1__name, self.db1__username, self.db1__password)
success, data = db.execute_query(
"SELECT * FROM Person", commit=False, as_dict=True
)
success, data = db.execute_query("SELECT * FROM Person", commit=False, as_dict=True)
self.assertEqual(success, True, "run sql query")
self.assertEqual(data[0]["row_count"], 5)

0 comments on commit e7aeb4e

Please sign in to comment.