1313
1414
1515@pytest .fixture ()
16- def profile_dataprofile_data ():
16+ def profile_data ():
1717 # create a sample profile data dictionary
1818 fake = Faker (locale = "en_US" )
1919 _username = fake .user_name ()
@@ -188,31 +188,58 @@ def profile_dataprofile_data():
188188 "description" : "" ,
189189 },
190190 ],
191+ #
192+ "activities" : [
193+ {
194+ "title" : fake .text (max_nb_chars = 50 ),
195+ "subtitle" : fake .text (max_nb_chars = 30 ),
196+ "image_url" : fake .image_url (),
197+ "link" : fake .uri (),
198+ }
199+ for _ in range (randint (1 , 3 ))
200+ ],
201+ "similar_profiles" : [
202+ {
203+ "url" : f"https://linkedin.com/in/{ fake .user_name ()} /" ,
204+ "name" : fake .name (),
205+ "title" : fake .job (),
206+ "image_url" : fake .image_url (),
207+ }
208+ for _ in range (randint (1 , 5 ))
209+ ],
210+ "patents" : [
211+ {
212+ "title" : fake .text (max_nb_chars = 100 ),
213+ "patent_id" : f"US{ randint (1000000 , 9999999 )} " ,
214+ "link" : f"https://patents.google.com/patent/US{ randint (1000000 , 9999999 )} " ,
215+ }
216+ for _ in range (randint (0 , 2 ))
217+ ],
191218 }
192219
193220 yield profile
194221 del profile
195222
196223
197224@pytest .mark .dependency ()
198- def test_profile_data_type (profile_dataprofile_data : dict [str , Any ]):
225+ def test_profile_data_type (profile_data : dict [str , Any ]):
199226 # check profile data validated successfull
200227 try :
201- Profile .model_validate (profile_dataprofile_data )
228+ Profile .model_validate (profile_data )
202229 except ValidationError as exc :
203230 assert False , "validating profile data failed : " + str (exc )
204231
205232
206233@pytest .mark .dependency ()
207- def test_profile_data_type_failing (profile_dataprofile_data : dict [str , Any ]):
234+ def test_profile_data_type_failing (profile_data : dict [str , Any ]):
208235 # validating profile data must fail
209- profile_dataprofile_data ["experience" ][0 ]["date" ]["start_date" ] = "none"
210- del profile_dataprofile_data ["education" ][0 ]["date" ]
211- del profile_dataprofile_data ["projects" ][0 ]["date" ]["end_date" ]
212- profile_dataprofile_data ["publications" ][0 ]["publication_date" ] = 12
213- profile_dataprofile_data ["honors_and_awards" ][0 ]["issued_date" ] = None
236+ profile_data ["experience" ][0 ]["date" ]["start_date" ] = "none"
237+ del profile_data ["education" ][0 ]["date" ]
238+ del profile_data ["projects" ][0 ]["date" ]["end_date" ]
239+ profile_data ["publications" ][0 ]["publication_date" ] = 12
240+ profile_data ["honors_and_awards" ][0 ]["issued_date" ] = None
214241 try :
215- Profile .model_validate (profile_dataprofile_data )
242+ Profile .model_validate (profile_data )
216243 except :
217244 pass
218245 else :
@@ -223,10 +250,10 @@ def test_profile_data_type_failing(profile_dataprofile_data: dict[str, Any]):
223250@pytest .mark .dependency (
224251 depends = ["test_profile_data_type" , "test_profile_data_type_failing" ]
225252)
226- def test_profile_data_response_type (profile_dataprofile_data : dict [str , Any ]):
253+ def test_profile_data_response_type (profile_data : dict [str , Any ]):
227254 try :
228255 response_schema = {
229- "data" : profile_dataprofile_data ,
256+ "data" : profile_data ,
230257 "usage" : {"credits" : randint (1 , 200 )},
231258 }
232259 ProfileDataResponse .model_validate (response_schema )
0 commit comments