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 6
6
import pymongo
7
7
from bson import json_util
8
8
from bson .binary import Binary
9
+ from django .conf import settings
9
10
from django .core .management import call_command
10
11
from django .db import connections , models
11
12
from django .test import TransactionTestCase , modify_settings , override_settings
@@ -340,12 +341,13 @@ def test_patientrecord(self):
340
341
341
342
# Test encrypted patient record in unencrypted database.
342
343
conn_params = connections ["encrypted" ].get_connection_params ()
344
+ db_name = settings .DATABASES ["encrypted" ]["NAME" ]
343
345
if conn_params .pop ("auto_encryption_opts" , False ):
344
346
# Call MongoClient instead of get_new_connection because
345
347
# get_new_connection will return the encrypted connection
346
348
# from the connection pool.
347
349
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 ()
349
351
ssn = patientrecords [0 ]["ssn" ]
350
352
self .assertTrue (isinstance (ssn , Binary ))
351
353
You can’t perform that action at this time.
0 commit comments