@@ -17,41 +17,41 @@ class TestOperationContextValidation(unittest.TestCase):
1717 """Tests for OperationContext format validation and PII rejection."""
1818
1919 def test_valid_single_pair (self ):
20- ctx = OperationContext (operation_context = "app=test/1.0" )
21- self .assertEqual (ctx .operation_context , "app=test/1.0" )
20+ ctx = OperationContext (user_agent_context = "app=test/1.0" )
21+ self .assertEqual (ctx .user_agent_context , "app=test/1.0" )
2222
2323 def test_valid_multiple_pairs (self ):
24- ctx = OperationContext (operation_context = "app=test/1.0;skill=dv-data;agent=claude-code" )
25- self .assertEqual (ctx .operation_context , "app=test/1.0;skill=dv-data;agent=claude-code" )
24+ ctx = OperationContext (user_agent_context = "app=test/1.0;skill=dv-data;agent=claude-code" )
25+ self .assertEqual (ctx .user_agent_context , "app=test/1.0;skill=dv-data;agent=claude-code" )
2626
2727 def test_valid_with_dots_slashes_hyphens (self ):
28- ctx = OperationContext (operation_context = "app=dataverse-skills/1.2.1" )
29- self .assertEqual (ctx .operation_context , "app=dataverse-skills/1.2.1" )
28+ ctx = OperationContext (user_agent_context = "app=dataverse-skills/1.2.1" )
29+ self .assertEqual (ctx .user_agent_context , "app=dataverse-skills/1.2.1" )
3030
3131 def test_reject_empty (self ):
3232 with self .assertRaises (ValueError ):
33- OperationContext (operation_context = "" )
33+ OperationContext (user_agent_context = "" )
3434
3535 def test_reject_email (self ):
3636 with self .assertRaises (ValueError ):
37- OperationContext (operation_context = "myname@email.com" )
37+ OperationContext (user_agent_context = "myname@email.com" )
3838
3939 def test_reject_freeform_text (self ):
4040 with self .assertRaises (ValueError ):
41- OperationContext (operation_context = "my bank password is 1234" )
41+ OperationContext (user_agent_context = "my bank password is 1234" )
4242
4343 def test_reject_control_chars (self ):
4444 for bad in ["has\r newline" , "has\n newline" , "has\x00 null" ]:
4545 with self .assertRaises (ValueError ):
46- OperationContext (operation_context = bad )
46+ OperationContext (user_agent_context = bad )
4747
4848 def test_reject_spaces (self ):
4949 with self .assertRaises (ValueError ):
50- OperationContext (operation_context = "app=my app" )
50+ OperationContext (user_agent_context = "app=my app" )
5151
5252 def test_reject_no_equals (self ):
5353 with self .assertRaises (ValueError ):
54- OperationContext (operation_context = "justaplainstring" )
54+ OperationContext (user_agent_context = "justaplainstring" )
5555
5656
5757class TestOperationContextConfig (unittest .TestCase ):
@@ -62,9 +62,9 @@ def test_default_is_none(self):
6262 self .assertIsNone (config .operation_context )
6363
6464 def test_explicit_value (self ):
65- ctx = OperationContext (operation_context = "app=test/1.0;agent=claude-code" )
65+ ctx = OperationContext (user_agent_context = "app=test/1.0;agent=claude-code" )
6666 config = DataverseConfig (operation_context = ctx )
67- self .assertEqual (config .operation_context .operation_context , "app=test/1.0;agent=claude-code" )
67+ self .assertEqual (config .operation_context .user_agent_context , "app=test/1.0;agent=claude-code" )
6868
6969 def test_default_constructor_is_none (self ):
7070 config = DataverseConfig ()
@@ -79,14 +79,14 @@ def setUp(self):
7979 self .base_url = "https://example.crm.dynamics.com"
8080
8181 def test_kwarg_sets_config (self ):
82- ctx = OperationContext (operation_context = "app=test/1.0;skill=dv-data;agent=claude-code" )
82+ ctx = OperationContext (user_agent_context = "app=test/1.0;skill=dv-data;agent=claude-code" )
8383 client = DataverseClient (
8484 self .base_url ,
8585 self .mock_credential ,
8686 context = ctx ,
8787 )
8888 self .assertEqual (
89- client ._config .operation_context .operation_context ,
89+ client ._config .operation_context .user_agent_context ,
9090 "app=test/1.0;skill=dv-data;agent=claude-code" ,
9191 )
9292
@@ -95,22 +95,22 @@ def test_no_kwarg_leaves_config_default(self):
9595 self .assertIsNone (client ._config .operation_context )
9696
9797 def test_config_and_context_raises (self ):
98- ctx = OperationContext (operation_context = "app=test/1.0" )
98+ ctx = OperationContext (user_agent_context = "app=test/1.0" )
9999 config = DataverseConfig (operation_context = ctx )
100100 with self .assertRaises (ValueError ):
101101 DataverseClient (
102102 self .base_url ,
103103 self .mock_credential ,
104104 config = config ,
105- context = OperationContext (operation_context = "app=other/2.0" ),
105+ context = OperationContext (user_agent_context = "app=other/2.0" ),
106106 )
107107
108108 def test_config_alone_works (self ):
109- ctx = OperationContext (operation_context = "app=test/1.0;agent=copilot" )
109+ ctx = OperationContext (user_agent_context = "app=test/1.0;agent=copilot" )
110110 config = DataverseConfig (operation_context = ctx )
111111 client = DataverseClient (self .base_url , self .mock_credential , config = config )
112112 self .assertEqual (
113- client ._config .operation_context .operation_context ,
113+ client ._config .operation_context .user_agent_context ,
114114 "app=test/1.0;agent=copilot" ,
115115 )
116116
@@ -132,7 +132,7 @@ def test_default_user_agent_unchanged(self):
132132
133133 def test_operation_context_appended (self ):
134134 ctx_str = "app=dataverse-skills/1.2.1;skill=dv-data;agent=claude-code"
135- ctx = OperationContext (operation_context = ctx_str )
135+ ctx = OperationContext (user_agent_context = ctx_str )
136136 config = DataverseConfig (operation_context = ctx )
137137 odata = _ODataClient (self .dummy_auth , self .base_url , config = config )
138138 headers = odata ._headers ()
@@ -146,4 +146,4 @@ def test_none_context_no_parentheses(self):
146146
147147 def test_empty_string_rejected_at_creation (self ):
148148 with self .assertRaises (ValueError ):
149- OperationContext (operation_context = "" )
149+ OperationContext (user_agent_context = "" )
0 commit comments