11from  unittest  import  TestCase 
2- from   src . basic_operations  import   * 
2+ import   basic_operations  as   bo 
33from  peewee  import  * 
4+ from  customer_model  import  * 
45
56database  =  SqliteDatabase (':memory:' )
67
@@ -21,7 +22,7 @@ def tearDown(self):
2122
2223    def  test_add_customer (self ):
2324
24-         add_customer ('C00001' , 'Kevin' , 'Cavanaugh' , '123 Main St' ,
25+         bo . add_customer ('C00001' , 'Kevin' , 'Cavanaugh' , '123 Main St' ,
2526                     '5551231234' , 
'[email protected] ' , 
'Active' , 
'750000' )
 2627
2728        new_test_cust  =  ['C00001' , 'Kevin' , 'Cavanaugh' , '123 Main St' ,
@@ -37,10 +38,10 @@ def test_add_customer(self):
3738        self .assertEqual (new_test_cust [7 ], Customer .credit_limit )
3839
3940    def  test_search_customer (self ):
40-         add_customer ('C00001' , 'Kevin' , 'Cavanaugh' , '123 Main St' ,
41+         bo . add_customer ('C00001' , 'Kevin' , 'Cavanaugh' , '123 Main St' ,
4142                     '5551231234' , 
'[email protected] ' , 
'Active' , 
'750000' )
 4243
43-         search  =  search_customer ('C00001' )
44+         search  =  bo . search_customer ('C00001' )
4445
4546        test_search  =  {
4647            'first_name' : 'Kevin' ,
@@ -52,21 +53,22 @@ def test_search_customer(self):
5253        self .assertDictEqual (test_search , search )
5354
5455    def  test_list_active_customers (self ):
55-         add_customer ('C00001' , 'Kevin' , 'Cavanaugh' , '123 Main St' ,
56+         bo . add_customer ('C00001' , 'Kevin' , 'Cavanaugh' , '123 Main St' ,
5657                     '5551231234' , 
'[email protected] ' , 
'Active' , 
'750000' )
 5758
58-         self .assertEqual (1 , list_active_customers ())
59+         self .assertEqual (1 , bo . list_active_customers ())
5960
6061    def  test_delete_customer (self ):
61-         add_customer ('C00001' , 'Kevin' , 'Cavanaugh' , '123 Main St' ,
62+         bo . add_customer ('C00001' , 'Kevin' , 'Cavanaugh' , '123 Main St' ,
6263                     '5551231234' , 
'[email protected] ' , 
'Active' , 
'750000' )
 6364
64-         self .assertEqual (True , delete_customer ('C00001' ))
65+         self .assertEqual (True , bo . delete_customer ('C00001' ))
6566
6667    def  test_update_customer (self ):
67-         add_customer ('C00001' , 'Kevin' , 'Cavanaugh' , '123 Main St' ,
68+         bo . add_customer ('C00001' , 'Kevin' , 'Cavanaugh' , '123 Main St' ,
6869                     '5551231234' , 
'[email protected] ' , 
'Active' , 
'750000' )
 69-         self .assertEqual (True , update_customer ('C00001' , 1500000 ))
70+         self .assertEqual (True , bo .update_customer ('C00001' , 1500000 ))
71+ 
7072
7173if  __name__  ==  "__main__" :
7274    unittest .main ()
0 commit comments