@@ -18,36 +18,36 @@ def client():
1818def test_get_list (client ):
1919 repository_mock = mock .Mock (spec = UserRepository )
2020 repository_mock .get_all .return_value = [
21- User (id = 1 , email = ' test1@email.com' , hashed_password = ' pwd' , is_active = True ),
22- User (id = 2 , email = ' test2@email.com' , hashed_password = ' pwd' , is_active = False ),
21+ User (id = 1 , email = " test1@email.com" , hashed_password = " pwd" , is_active = True ),
22+ User (id = 2 , email = " test2@email.com" , hashed_password = " pwd" , is_active = False ),
2323 ]
2424
2525 with app .container .user_repository .override (repository_mock ):
26- response = client .get (' /users' )
26+ response = client .get (" /users" )
2727
2828 assert response .status_code == 200
2929 data = response .json ()
3030 assert data == [
31- {'id' : 1 , ' email' : ' test1@email.com' , ' hashed_password' : ' pwd' , ' is_active' : True },
32- {'id' : 2 , ' email' : ' test2@email.com' , ' hashed_password' : ' pwd' , ' is_active' : False },
31+ {"id" : 1 , " email" : " test1@email.com" , " hashed_password" : " pwd" , " is_active" : True },
32+ {"id" : 2 , " email" : " test2@email.com" , " hashed_password" : " pwd" , " is_active" : False },
3333 ]
3434
3535
3636def test_get_by_id (client ):
3737 repository_mock = mock .Mock (spec = UserRepository )
3838 repository_mock .get_by_id .return_value = User (
3939 id = 1 ,
40- email = ' xyz@email.com' ,
41- hashed_password = ' pwd' ,
40+ email = " xyz@email.com" ,
41+ hashed_password = " pwd" ,
4242 is_active = True ,
4343 )
4444
4545 with app .container .user_repository .override (repository_mock ):
46- response = client .get (' /users/1' )
46+ response = client .get (" /users/1" )
4747
4848 assert response .status_code == 200
4949 data = response .json ()
50- assert data == {'id' : 1 , ' email' : ' xyz@email.com' , ' hashed_password' : ' pwd' , ' is_active' : True }
50+ assert data == {"id" : 1 , " email" : " xyz@email.com" , " hashed_password" : " pwd" , " is_active" : True }
5151 repository_mock .get_by_id .assert_called_once_with (1 )
5252
5353
@@ -56,35 +56,35 @@ def test_get_by_id_404(client):
5656 repository_mock .get_by_id .side_effect = UserNotFoundError (1 )
5757
5858 with app .container .user_repository .override (repository_mock ):
59- response = client .get (' /users/1' )
59+ response = client .get (" /users/1" )
6060
6161 assert response .status_code == 404
6262
6363
64- @mock .patch (' webapp.services.uuid4' , return_value = ' xyz' )
64+ @mock .patch (" webapp.services.uuid4" , return_value = " xyz" )
6565def test_add (_ , client ):
6666 repository_mock = mock .Mock (spec = UserRepository )
6767 repository_mock .add .return_value = User (
6868 id = 1 ,
69- email = ' xyz@email.com' ,
70- hashed_password = ' pwd' ,
69+ email = " xyz@email.com" ,
70+ hashed_password = " pwd" ,
7171 is_active = True ,
7272 )
7373
7474 with app .container .user_repository .override (repository_mock ):
75- response = client .post (' /users' )
75+ response = client .post (" /users" )
7676
7777 assert response .status_code == 201
7878 data = response .json ()
79- assert data == {'id' : 1 , ' email' : ' xyz@email.com' , ' hashed_password' : ' pwd' , ' is_active' : True }
80- repository_mock .add .assert_called_once_with (email = ' xyz@email.com' , password = ' pwd' )
79+ assert data == {"id" : 1 , " email" : " xyz@email.com" , " hashed_password" : " pwd" , " is_active" : True }
80+ repository_mock .add .assert_called_once_with (email = " xyz@email.com" , password = " pwd" )
8181
8282
8383def test_remove (client ):
8484 repository_mock = mock .Mock (spec = UserRepository )
8585
8686 with app .container .user_repository .override (repository_mock ):
87- response = client .delete (' /users/1' )
87+ response = client .delete (" /users/1" )
8888
8989 assert response .status_code == 204
9090 repository_mock .delete_by_id .assert_called_once_with (1 )
@@ -95,13 +95,13 @@ def test_remove_404(client):
9595 repository_mock .delete_by_id .side_effect = UserNotFoundError (1 )
9696
9797 with app .container .user_repository .override (repository_mock ):
98- response = client .delete (' /users/1' )
98+ response = client .delete (" /users/1" )
9999
100100 assert response .status_code == 404
101101
102102
103103def test_status (client ):
104- response = client .get (' /status' )
104+ response = client .get (" /status" )
105105 assert response .status_code == 200
106106 data = response .json ()
107- assert data == {' status' : 'OK' }
107+ assert data == {" status" : "OK" }
0 commit comments