File tree Expand file tree Collapse file tree 1 file changed +3
-1
lines changed Expand file tree Collapse file tree 1 file changed +3
-1
lines changed Original file line number Diff line number Diff line change 66import pymongo
77from bson import json_util
88from bson .binary import Binary
9+ from django .conf import settings
910from django .core .management import call_command
1011from django .db import connections , models
1112from django .test import TransactionTestCase , modify_settings , override_settings
@@ -340,12 +341,13 @@ def test_patientrecord(self):
340341
341342 # Test encrypted patient record in unencrypted database.
342343 conn_params = connections ["encrypted" ].get_connection_params ()
344+ db_name = settings .DATABASES ["encrypted" ]["NAME" ]
343345 if conn_params .pop ("auto_encryption_opts" , False ):
344346 # Call MongoClient instead of get_new_connection because
345347 # get_new_connection will return the encrypted connection
346348 # from the connection pool.
347349 with pymongo .MongoClient (** conn_params ) as new_connection :
348- patientrecords = new_connection ["test_encrypted" ].encryption__patientrecord .find ()
350+ patientrecords = new_connection [db_name ].encryption__patientrecord .find ()
349351 ssn = patientrecords [0 ]["ssn" ]
350352 self .assertTrue (isinstance (ssn , Binary ))
351353
You can’t perform that action at this time.
0 commit comments