33from decimal import Decimal
44from peepdb .core import peep_db
55from peepdb .config import save_connection , get_connection , list_connections , remove_connection , remove_all_connections
6- from peepdb .db import MySQLDatabase , PostgreSQLDatabase , MariaDBDatabase , MongoDBDatabase , FirebaseDatabase
6+ from peepdb .db import MySQLDatabase , PostgreSQLDatabase , MariaDBDatabase , MongoDBDatabase , FirebaseDatabase , OracleDatabase
77
88
99@patch ('peepdb.core.FirebaseDatabase' )
1010@patch ('peepdb.core.MongoDBDatabase' )
1111@patch ('peepdb.core.MySQLDatabase' )
1212@patch ('peepdb.core.PostgreSQLDatabase' )
1313@patch ('peepdb.core.MariaDBDatabase' )
14- def test_peep_db (mock_mariadb , mock_postgresql , mock_mysql , mock_mongodb , mock_firebase_db ):
14+ @patch ('peepdb.core.OracleDatabase' )
15+ def test_peep_db (mock_mariadb , mock_postgresql , mock_mysql , mock_mongodb , mock_firebase_db , mock_oracle_db ):
1516 # Create a mock database object
1617 mock_db = Mock ()
1718 mock_db .fetch_tables .return_value = ['table1' , 'table2' ]
@@ -31,6 +32,7 @@ def test_peep_db(mock_mariadb, mock_postgresql, mock_mysql, mock_mongodb, mock_f
3132 mock_mariadb .return_value = mock_db
3233 mock_mongodb .return_value = mock_db
3334 mock_firebase_db .return_value = mock_db
35+ mock_oracle_db .return_value = mock_db
3436
3537 # Expected result for non-scientific, JSON format
3638 expected_result = {
@@ -81,6 +83,10 @@ def test_peep_db(mock_mariadb, mock_postgresql, mock_mysql, mock_mongodb, mock_f
8183 result = peep_db ('mongodb' , 'host' , 'user' , 'password' , 'database' , format = 'json' , scientific = False )
8284 assert result == expected_result
8385
86+ # Test OracleDB without scientific notation
87+ result = peep_db ('oracle' , 'host' , 'user' , 'password' , 'database' , format = 'json' , scientific = False )
88+ assert result == expected_result
89+
8490 # Test Firebase without scientific notation
8591 result = peep_db ('firebase' , 'path/to/serviceAccountKey.json' , '' , '' , '' , format = 'json' , scientific = False )
8692 assert result == expected_result
@@ -105,6 +111,10 @@ def test_peep_db(mock_mariadb, mock_postgresql, mock_mysql, mock_mongodb, mock_f
105111 result = peep_db ('mongodb' , 'host' , 'user' , 'password' , 'database' , format = 'json' , scientific = True )
106112 assert result == expected_result
107113
114+ # Test OracleDB with scientific notation
115+ result = peep_db ('oracle' , 'host' , 'user' , 'password' , 'database' , format = 'json' , scientific = True )
116+ assert result == expected_result
117+
108118 # Test fetching a specific table/collection for Firebase
109119 result = peep_db ('firebase' , 'path/to/serviceAccountKey.json' , '' , '' , '' , table = 'table1' , format = 'json' , scientific = False )
110120 assert result == {'table1' : expected_result ['table1' ]}
0 commit comments