88""" 
991300 - Module for testing the AsyncProfile proxy object 
1010""" 
11+ import  uuid 
1112
1213import  oracledb 
1314import  pytest 
1415import  select_ai 
1516from  select_ai  import  AsyncProfile , ProfileAttributes 
1617
17- 
18- @pytest .fixture (scope = "module" ) 
19- def  provider ():
20-     return  select_ai .OCIGenAIProvider (
21-         region = "us-phoenix-1" , oci_apiformat = "GENERIC" 
22-     )
23- 
24- 
25- @pytest .fixture (scope = "module" ) 
26- def  profile_attributes (provider , oci_credential ):
27-     return  ProfileAttributes (
28-         credential_name = oci_credential ["credential_name" ],
29-         object_list = [{"owner" : "SH" }],
30-         provider = provider ,
31-     )
32- 
33- 
34- @pytest .fixture (scope = "module" ) 
35- def  min_profile_attributes (provider , oci_credential ):
36-     return  ProfileAttributes (
37-         credential_name = oci_credential ["credential_name" ],
38-         provider = select_ai .OCIGenAIProvider (),
39-     )
18+ PYSAI_ASYNC_1300_PROFILE  =  f"PYSAI_ASYNC_1300_{ uuid .uuid4 ().hex .upper ()}  
19+ PYSAI_ASYNC_1300_PROFILE_2  =  f"PYSAI_ASYNC_1300_2_{ uuid .uuid4 ().hex .upper ()}  
20+ PYSAI_ASYNC_1300_MIN_ATTR_PROFILE  =  (
21+     f"PYSAI_ASYNC_1300_MIN_{ uuid .uuid4 ().hex .upper ()}  
22+ )
23+ PYSAI_ASYNC_1300_DUP_PROFILE  =  (
24+     f"PYSAI_ASYNC_1300_DUP_{ uuid .uuid4 ().hex .upper ()}  
25+ )
4026
4127
4228@pytest .fixture (scope = "module" ) 
4329async  def  python_gen_ai_profile (profile_attributes ):
4430    profile  =  await  AsyncProfile (
45-         profile_name = "PYTHON_GENAI_PROFILE" ,
31+         profile_name = PYSAI_ASYNC_1300_PROFILE ,
4632        description = "OCI GENAI Profile" ,
4733        attributes = profile_attributes ,
4834    )
@@ -53,7 +39,7 @@ async def python_gen_ai_profile(profile_attributes):
5339@pytest .fixture (scope = "module" ) 
5440async  def  python_gen_ai_profile_2 (profile_attributes ):
5541    profile  =  await  AsyncProfile (
56-         profile_name = "PYTHON_GENAI_PROFILE_2" ,
42+         profile_name = PYSAI_ASYNC_1300_PROFILE_2 ,
5743        description = "OCI GENAI Profile 2" ,
5844        attributes = profile_attributes ,
5945    )
@@ -65,7 +51,7 @@ async def python_gen_ai_profile_2(profile_attributes):
6551@pytest .fixture (scope = "module" ) 
6652async  def  python_gen_ai_min_attr_profile (min_profile_attributes ):
6753    profile  =  await  AsyncProfile (
68-         profile_name = "PYTHON_MIN_ATTRIB_PROFILE" ,
54+         profile_name = PYSAI_ASYNC_1300_MIN_ATTR_PROFILE ,
6955        attributes = min_profile_attributes ,
7056        description = None ,
7157    )
@@ -76,7 +62,7 @@ async def python_gen_ai_min_attr_profile(min_profile_attributes):
7662@pytest .fixture  
7763async  def  python_gen_ai_duplicate_profile (min_profile_attributes ):
7864    profile  =  await  AsyncProfile (
79-         profile_name = "PYTHON_DUPLICATE_PROFILE" ,
65+         profile_name = PYSAI_ASYNC_1300_DUP_PROFILE ,
8066        attributes = min_profile_attributes ,
8167    )
8268    yield  profile 
@@ -85,26 +71,26 @@ async def python_gen_ai_duplicate_profile(min_profile_attributes):
8571
8672def  test_1300 (python_gen_ai_profile , profile_attributes ):
8773    """Create basic Profile""" 
88-     assert  python_gen_ai_profile .profile_name  ==  "PYTHON_GENAI_PROFILE" 
74+     assert  python_gen_ai_profile .profile_name  ==  PYSAI_ASYNC_1300_PROFILE 
8975    assert  python_gen_ai_profile .attributes  ==  profile_attributes 
9076    assert  python_gen_ai_profile .description  ==  "OCI GENAI Profile" 
9177
9278
9379def  test_1301 (python_gen_ai_profile_2 , profile_attributes ):
9480    """Create Profile using create method""" 
95-     assert  python_gen_ai_profile_2 .profile_name  ==  "PYTHON_GENAI_PROFILE_2" 
81+     assert  python_gen_ai_profile_2 .profile_name  ==  PYSAI_ASYNC_1300_PROFILE_2 
9682    assert  python_gen_ai_profile_2 .attributes  ==  profile_attributes 
9783    assert  python_gen_ai_profile_2 .description  ==  "OCI GENAI Profile 2" 
9884
9985
10086async  def  test_1302 (profile_attributes ):
10187    """Create duplicate profile with replace=True""" 
10288    duplicate  =  await  AsyncProfile (
103-         profile_name = "PYTHON_GENAI_PROFILE" ,
89+         profile_name = PYSAI_ASYNC_1300_PROFILE ,
10490        attributes = profile_attributes ,
10591        replace = True ,
10692    )
107-     assert  duplicate .profile_name  ==  "PYTHON_GENAI_PROFILE" 
93+     assert  duplicate .profile_name  ==  PYSAI_ASYNC_1300_PROFILE 
10894    assert  duplicate .attributes  ==  profile_attributes 
10995    assert  duplicate .description  is  None 
11096
@@ -113,7 +99,7 @@ def test_1303(python_gen_ai_min_attr_profile, min_profile_attributes):
11399    """Create Profile with minimum required attributes""" 
114100    assert  (
115101        python_gen_ai_min_attr_profile .profile_name 
116-         ==  "PYTHON_MIN_ATTRIB_PROFILE" 
102+         ==  PYSAI_ASYNC_1300_MIN_ATTR_PROFILE 
117103    )
118104    assert  python_gen_ai_min_attr_profile .attributes  ==  min_profile_attributes 
119105    assert  python_gen_ai_min_attr_profile .description  is  None 
@@ -122,30 +108,36 @@ def test_1303(python_gen_ai_min_attr_profile, min_profile_attributes):
122108async  def  test_1304 ():
123109    """List profiles without regex""" 
124110    profile_list  =  [await  profile  async  for  profile  in  AsyncProfile .list ()]
125-     assert  len (profile_list ) ==  3 
111+     profile_names  =  set (profile .profile_name  for  profile  in  profile_list )
112+     assert  PYSAI_ASYNC_1300_PROFILE  in  profile_names 
113+     assert  PYSAI_ASYNC_1300_PROFILE_2  in  profile_names 
114+     assert  PYSAI_ASYNC_1300_MIN_ATTR_PROFILE  in  profile_names 
126115
127116
128117async  def  test_1305 ():
129118    """List profiles with regex""" 
130119    profile_list  =  [
131120        await  profile 
132121        async  for  profile  in  AsyncProfile .list (
133-             profile_name_pattern = ".*PROFILE$ " 
122+             profile_name_pattern = "^PYSAI_ASYNC_1300 " 
134123        )
135124    ]
136-     assert  len (profile_list ) ==  2 
125+     profile_names  =  set (profile .profile_name  for  profile  in  profile_list )
126+     assert  PYSAI_ASYNC_1300_PROFILE  in  profile_names 
127+     assert  PYSAI_ASYNC_1300_PROFILE_2  in  profile_names 
128+     assert  PYSAI_ASYNC_1300_MIN_ATTR_PROFILE  in  profile_names 
137129
138130
139131async  def  test_1306 (profile_attributes ):
140132    """Get attributes for a Profile""" 
141-     profile  =  await  AsyncProfile ("PYTHON_GENAI_PROFILE" )
133+     profile  =  await  AsyncProfile (PYSAI_ASYNC_1300_PROFILE )
142134    fetched_attributes  =  await  profile .get_attributes ()
143135    assert  fetched_attributes  ==  profile_attributes 
144136
145137
146138async  def  test_1307 ():
147139    """Set attributes for a Profile""" 
148-     profile  =  await  AsyncProfile ("PYTHON_GENAI_PROFILE" )
140+     profile  =  await  AsyncProfile (PYSAI_ASYNC_1300_PROFILE )
149141    assert  profile .attributes .provider .model  is  None 
150142    await  profile .set_attribute (
151143        attribute_name = "model" , attribute_value = "meta.llama-3.1-70b-instruct" 
@@ -155,7 +147,7 @@ async def test_1307():
155147
156148async  def  test_1308 (oci_credential ):
157149    """Set multiple attributes for a Profile""" 
158-     profile  =  await  AsyncProfile ("PYTHON_GENAI_PROFILE" )
150+     profile  =  await  AsyncProfile (PYSAI_ASYNC_1300_PROFILE )
159151    profile_attrs  =  ProfileAttributes (
160152        credential_name = oci_credential ["credential_name" ],
161153        provider = select_ai .OCIGenAIProvider (),
0 commit comments