41
41
)
42
42
from ansible_ai_connect .ai .api .model_pipelines .tests import mock_pipeline_config
43
43
from ansible_ai_connect .main import ssl_manager
44
- from ansible_ai_connect .organizations .models import Organization
44
+ from ansible_ai_connect .organizations .models import ExternalOrganization
45
45
from ansible_ai_connect .test_utils import (
46
46
APIVersionTestCaseBase ,
47
47
WisdomServiceAPITestCaseBase ,
@@ -114,7 +114,7 @@ class TestChatView(APIVersionTestCaseBase, WisdomServiceAPITestCaseBase):
114
114
115
115
def setUp (self ):
116
116
super ().setUp ()
117
- (org , _ ) = Organization .objects .get_or_create (id = 123 , telemetry_opt_out = False )
117
+ (org , _ ) = ExternalOrganization .objects .get_or_create (id = 123 , telemetry_opt_out = False )
118
118
self .user .organization = org
119
119
self .user .rh_internal = True
120
120
@@ -307,7 +307,7 @@ def test_chat_with_system_prompt_override(self):
307
307
@override_settings (SEGMENT_WRITE_KEY = "DUMMY_KEY_VALUE" )
308
308
def test_operational_telemetry (self ):
309
309
self .user .rh_user_has_seat = True
310
- self .user .organization = Organization .objects .get_or_create (id = 1 )[0 ]
310
+ self .user .organization = ExternalOrganization .objects .get_or_create (id = 1 )[0 ]
311
311
self .client .force_authenticate (user = self .user )
312
312
with (
313
313
patch .object (
@@ -390,7 +390,7 @@ def test_operational_telemetry_limit_exceeded(self):
390
390
@override_settings (SEGMENT_WRITE_KEY = "DUMMY_KEY_VALUE" )
391
391
def test_operational_telemetry_anonymizer (self ):
392
392
self .user .rh_user_has_seat = True
393
- self .user .organization = Organization .objects .get_or_create (id = 1 )[0 ]
393
+ self .user .organization = ExternalOrganization .objects .get_or_create (id = 1 )[0 ]
394
394
self .client .force_authenticate (user = self .user )
395
395
with (
396
396
patch .object (
@@ -414,7 +414,7 @@ def test_operational_telemetry_anonymizer(self):
414
414
@override_settings (SEGMENT_WRITE_KEY = "DUMMY_KEY_VALUE" )
415
415
def test_operational_telemetry_with_system_prompt_override (self ):
416
416
self .user .rh_user_has_seat = True
417
- self .user .organization = Organization .objects .get_or_create (id = 1 )[0 ]
417
+ self .user .organization = ExternalOrganization .objects .get_or_create (id = 1 )[0 ]
418
418
self .client .force_authenticate (user = self .user )
419
419
with (
420
420
patch .object (
@@ -450,7 +450,7 @@ def test_operational_telemetry_with_system_prompt_override(self):
450
450
@override_settings (SEGMENT_WRITE_KEY = "DUMMY_KEY_VALUE" )
451
451
def test_operational_telemetry_with_no_tools_option (self ):
452
452
self .user .rh_user_has_seat = True
453
- self .user .organization = Organization .objects .get_or_create (id = 1 )[0 ]
453
+ self .user .organization = ExternalOrganization .objects .get_or_create (id = 1 )[0 ]
454
454
self .client .force_authenticate (user = self .user )
455
455
with (
456
456
patch .object (
@@ -491,7 +491,7 @@ def test_chat_rate_limit(self):
491
491
email = email ,
492
492
password = password ,
493
493
)
494
- (org , _ ) = Organization .objects .get_or_create (id = 123 , telemetry_opt_out = False )
494
+ (org , _ ) = ExternalOrganization .objects .get_or_create (id = 123 , telemetry_opt_out = False )
495
495
self .user2 .organization = org
496
496
self .user2 .rh_internal = True
497
497
# Call chart API five times using self.user2
@@ -507,7 +507,7 @@ def test_chat_rate_limit(self):
507
507
def test_operational_telemetry_excludes_chat_prompt_by_default (self ):
508
508
"""Test that chat_prompt is excluded from telemetry by default (via allow list)"""
509
509
self .user .rh_user_has_seat = True
510
- self .user .organization = Organization .objects .get_or_create (id = 1 )[0 ]
510
+ self .user .organization = ExternalOrganization .objects .get_or_create (id = 1 )[0 ]
511
511
self .client .force_authenticate (user = self .user )
512
512
with (
513
513
patch .object (
@@ -538,7 +538,7 @@ def test_not_rh_internal_user(self):
538
538
self .user2 = get_user_model ().objects .create_user (
539
539
username = username ,
540
540
)
541
- self .user2 .organization = Organization .objects .get_or_create (
541
+ self .user2 .organization = ExternalOrganization .objects .get_or_create (
542
542
id = 123 , telemetry_opt_out = False
543
543
)[0 ]
544
544
self .user2 .rh_internal = False
@@ -553,7 +553,7 @@ class TestStreamingChatView(APIVersionTestCaseBase, WisdomServiceAPITestCaseBase
553
553
554
554
def setUp (self ):
555
555
super ().setUp ()
556
- (org , _ ) = Organization .objects .get_or_create (id = 123 , telemetry_opt_out = False )
556
+ (org , _ ) = ExternalOrganization .objects .get_or_create (id = 123 , telemetry_opt_out = False )
557
557
self .user .organization = org
558
558
self .user .rh_internal = True
559
559
@@ -663,7 +663,7 @@ def test_chat_internal_server_exception(self):
663
663
@override_settings (SEGMENT_WRITE_KEY = "DUMMY_KEY_VALUE" )
664
664
def test_operational_telemetry (self ):
665
665
self .user .rh_user_has_seat = True
666
- self .user .organization = Organization .objects .get_or_create (id = 1 )[0 ]
666
+ self .user .organization = ExternalOrganization .objects .get_or_create (id = 1 )[0 ]
667
667
self .client .force_authenticate (user = self .user )
668
668
with (
669
669
patch .object (
@@ -723,7 +723,7 @@ def test_operational_telemetry_limit_exceeded(self):
723
723
@override_settings (SEGMENT_WRITE_KEY = "DUMMY_KEY_VALUE" )
724
724
def test_operational_telemetry_anonymizer (self ):
725
725
self .user .rh_user_has_seat = True
726
- self .user .organization = Organization .objects .get_or_create (id = 1 )[0 ]
726
+ self .user .organization = ExternalOrganization .objects .get_or_create (id = 1 )[0 ]
727
727
self .client .force_authenticate (user = self .user )
728
728
with (
729
729
patch .object (
@@ -747,7 +747,7 @@ def test_operational_telemetry_anonymizer(self):
747
747
@override_settings (SEGMENT_WRITE_KEY = "DUMMY_KEY_VALUE" )
748
748
def test_operational_telemetry_with_system_prompt_override (self ):
749
749
self .user .rh_user_has_seat = True
750
- self .user .organization = Organization .objects .get_or_create (id = 1 )[0 ]
750
+ self .user .organization = ExternalOrganization .objects .get_or_create (id = 1 )[0 ]
751
751
self .client .force_authenticate (user = self .user )
752
752
with (
753
753
patch .object (
@@ -781,7 +781,7 @@ def test_operational_telemetry_with_system_prompt_override(self):
781
781
@override_settings (SEGMENT_WRITE_KEY = "DUMMY_KEY_VALUE" )
782
782
def test_operational_telemetry_with_no_tools_option (self ):
783
783
self .user .rh_user_has_seat = True
784
- self .user .organization = Organization .objects .get_or_create (id = 1 )[0 ]
784
+ self .user .organization = ExternalOrganization .objects .get_or_create (id = 1 )[0 ]
785
785
self .client .force_authenticate (user = self .user )
786
786
with (
787
787
patch .object (
@@ -821,7 +821,7 @@ def test_chat_rate_limit(self):
821
821
email = email ,
822
822
password = password ,
823
823
)
824
- (org , _ ) = Organization .objects .get_or_create (id = 123 , telemetry_opt_out = False )
824
+ (org , _ ) = ExternalOrganization .objects .get_or_create (id = 123 , telemetry_opt_out = False )
825
825
self .user2 .organization = org
826
826
self .user2 .rh_internal = True
827
827
# Call chart API five times using self.user2
@@ -839,7 +839,7 @@ def test_not_rh_internal_user(self):
839
839
self .user2 = get_user_model ().objects .create_user (
840
840
username = username ,
841
841
)
842
- self .user2 .organization = Organization .objects .get_or_create (
842
+ self .user2 .organization = ExternalOrganization .objects .get_or_create (
843
843
id = 123 , telemetry_opt_out = False
844
844
)[0 ]
845
845
self .user2 .rh_internal = False
0 commit comments