1- # noqa: WPS402
21import pytest
32
43from mpt_api_client .exceptions import MPTAPIError
87
98
109@pytest .fixture
11- def users (mpt_vendor , account_id ): # noqa: WPS204
10+ def users (mpt_vendor , account_id ):
1211 return mpt_vendor .accounts .accounts .users (account_id = account_id ) # noqa: WPS204
1312
1413
@@ -76,21 +75,23 @@ def created_account_user_group(mpt_vendor, created_account_user, created_user_gr
7675 print (f"TEARDOWN - Unable to delete account user group: { error .title } " ) # noqa: WPS421
7776
7877
79- def test_get_account_user_by_id (mpt_vendor , user_id , account_id ): # noqa: AAA01
78+ def test_get_account_user_by_id (mpt_vendor , user_id , account_id ):
8079 """Test retrieving an account user by ID."""
8180 users_obj = mpt_vendor .accounts .accounts .users (account_id = account_id )
82- account_user = users_obj .get (user_id )
83- assert account_user is not None
8481
82+ result = users_obj .get (user_id )
8583
86- def test_list_account_users (mpt_vendor , account_id ): # noqa: AAA01
84+ assert result is not None
85+
86+
87+ def test_list_account_users (mpt_vendor , account_id ):
8788 """Test listing account users."""
8889 limit = 10
89-
9090 users_obj = mpt_vendor .accounts .accounts .users (account_id = account_id )
91- account_users = users_obj .fetch_page (limit = limit )
9291
93- assert len (account_users ) > 0
92+ result = users_obj .fetch_page (limit = limit )
93+
94+ assert len (result ) > 0
9495
9596
9697def test_get_account_user_by_id_not_found (mpt_vendor , invalid_user_id , account_id ):
@@ -101,31 +102,34 @@ def test_get_account_user_by_id_not_found(mpt_vendor, invalid_user_id, account_i
101102 users_obj .get (invalid_user_id )
102103
103104
104- def test_filter_account_users (mpt_vendor , user_id , account_id ): # noqa: AAA01
105+ def test_filter_account_users (mpt_vendor , user_id , account_id ):
105106 """Test filtering account users."""
106107 select_fields = ["-name" ]
107-
108108 users_obj = mpt_vendor .accounts .accounts .users (account_id = account_id )
109109 filtered_account_users = users_obj .filter (RQLQuery (id = user_id )).select (* select_fields )
110- account_users = list (filtered_account_users .iterate ())
111110
112- assert len ( account_users ) == 1
111+ result = list ( filtered_account_users . iterate ())
113112
113+ assert len (result ) == 1
114114
115- def test_create_account_user (created_account_user ): # noqa: AAA01
115+
116+ def test_create_account_user (created_account_user ):
116117 """Test creating an account user."""
117- account_user_data = created_account_user ()
118- assert account_user_data is not None
118+ result = created_account_user ()
119+
120+ assert result is not None
119121
120122
121- def test_delete_account_user (mpt_vendor , created_account_user , account_id ): # noqa: AAA01
123+ def test_delete_account_user (mpt_vendor , created_account_user , account_id ):
122124 """Test deleting an account user."""
123125 account_user_data = created_account_user ()
124- users_obj = mpt_vendor .accounts .accounts .users (account_id = account_id )
125- users_obj .delete (account_user_data .id )
126126
127+ result = mpt_vendor .accounts .accounts .users (account_id = account_id )
128+
129+ result .delete (account_user_data .id )
127130
128- def test_update_account_user ( # noqa: AAA01
131+
132+ def test_update_account_user (
129133 mpt_vendor ,
130134 account_user_factory ,
131135 created_account_user ,
@@ -138,32 +142,37 @@ def test_update_account_user( # noqa: AAA01
138142 first_name = "E2E Updated" ,
139143 last_name = "Account User" ,
140144 )
141- updated_account_user = users_obj .update (
145+
146+ result = users_obj .update (
142147 account_user_data .id ,
143148 updated_account_user_data ,
144149 )
145- assert updated_account_user is not None
150+
151+ assert result is not None
146152
147153
148- def test_account_user_resend_invite ( # noqa: AAA01
154+ def test_account_user_resend_invite (
149155 mpt_vendor ,
150156 created_account_user ,
151157 account_id ,
152158):
153159 """Test resending an invite to an account user."""
154160 account_user_data = created_account_user ()
155161 users_obj = mpt_vendor .accounts .accounts .users (account_id = account_id )
156- resend_invite = users_obj .resend_invite (account_user_data .id )
157- assert resend_invite is not None
162+
163+ result = users_obj .resend_invite (account_user_data .id )
164+
165+ assert result is not None
158166
159167
160- def test_account_user_group_post (created_account_user_group ): # noqa: AAA01
168+ def test_account_user_group_post (created_account_user_group ):
161169 """Test creating an account user group."""
162- created_account_user_group_data = created_account_user_group
163- assert created_account_user_group_data is not None
170+ result = created_account_user_group
164171
172+ assert result is not None
165173
166- def test_account_user_group_update ( # noqa: AAA01
174+
175+ def test_account_user_group_update (
167176 mpt_vendor ,
168177 created_account_user ,
169178 created_user_group ,
@@ -173,13 +182,13 @@ def test_account_user_group_update( # noqa: AAA01
173182 created_account_user_data = created_account_user ()
174183 users_obj = mpt_vendor .accounts .accounts .users (account_id = account_id )
175184 update_user_group_data = [{"id" : created_user_group .id }]
176- updated_account_user_group = users_obj .groups (user_id = created_account_user_data .id ).update (
177- update_user_group_data
178- )
179- assert updated_account_user_group is not None
180185
186+ result = users_obj .groups (user_id = created_account_user_data .id ).update (update_user_group_data )
187+
188+ assert result is not None
181189
182- def test_account_user_group_delete ( # noqa: AAA01
190+
191+ def test_account_user_group_delete (
183192 mpt_vendor ,
184193 created_account_user ,
185194 created_user_group ,
@@ -190,4 +199,5 @@ def test_account_user_group_delete( # noqa: AAA01
190199 users_obj = mpt_vendor .accounts .accounts .users (account_id = account_id )
191200 create_user_group_data = {"id" : created_user_group .id }
192201 users_obj .groups (user_id = created_account_user_data .id ).create (create_user_group_data )
193- users_obj .groups (user_id = created_account_user_data .id ).delete (created_user_group .id )
202+
203+ users_obj .groups (user_id = created_account_user_data .id ).delete (created_user_group .id ) # act
0 commit comments