@@ -30,7 +30,7 @@ async def check_database_users_existence(
3030 """
3131 unit = ops_test .model .applications [DATABASE_APP_NAME ].units [0 ]
3232 unit_address = await get_unit_address (ops_test , unit .name )
33- password = await get_operator_password (ops_test )
33+ password = await get_password (ops_test )
3434
3535 # Retrieve all users in the database.
3636 output = await execute_query_on_unit (
@@ -61,7 +61,7 @@ async def check_database_creation(ops_test: OpsTest, database: str) -> None:
6161 ops_test: The ops test framework
6262 database: Name of the database that should have been created
6363 """
64- password = await get_operator_password (ops_test )
64+ password = await get_password (ops_test )
6565
6666 for unit in ops_test .model .applications [DATABASE_APP_NAME ].units :
6767 unit_address = await get_unit_address (ops_test , unit .name )
@@ -196,12 +196,12 @@ def get_application_units(ops_test: OpsTest, application_name: str) -> List[str]
196196 ]
197197
198198
199- async def get_operator_password (ops_test : OpsTest ):
200- """Retrieve the operator user password using the action."""
199+ async def get_password (ops_test : OpsTest , username : str = "operator" ):
200+ """Retrieve a user password using the action."""
201201 unit = ops_test .model .units .get (f"{ DATABASE_APP_NAME } /0" )
202- action = await unit .run_action ("get-password" )
202+ action = await unit .run_action ("get-password" , ** { "username" : username } )
203203 result = await action .wait ()
204- return result .results ["operator -password" ]
204+ return result .results [f" { username } -password" ]
205205
206206
207207async def get_primary (ops_test : OpsTest , unit_id = 0 ) -> str :
0 commit comments