@@ -10,7 +10,6 @@ def sample_field_complete():
1010 name = "transaction_amount" ,
1111 description = "Monetary amount of transaction in cents" ,
1212 field_type = FieldType .number ,
13- example = 1299 ,
1413 )
1514
1615
@@ -21,26 +20,21 @@ def sample_boolean_field():
2120 name = "is_premium_user" ,
2221 description = "Whether user has premium subscription" ,
2322 field_type = FieldType .boolean ,
24- example = True ,
2523 )
2624
2725
2826# Test different field types
2927def test_create_string_field (auth_client ):
3028 """Test creating string field"""
3129 field_data = FieldCreate (
32- name = "user_email" ,
33- description = "User email address" ,
34- field_type = FieldType .string ,
35- example = "user@example.com" ,
30+ name = "user_email" , description = "User email address" , field_type = FieldType .string
3631 )
3732
3833 response = auth_client .post ("/v1/fields/" , json = field_data .model_dump ())
3934 assert response .status_code == 201
4035
4136 data = response .json ()
4237 assert data ["field_type" ] == "string"
43- assert data ["example" ] == "user@example.com"
4438
4539
4640def test_create_number_field (auth_client , sample_field_complete ):
@@ -50,7 +44,6 @@ def test_create_number_field(auth_client, sample_field_complete):
5044
5145 data = response .json ()
5246 assert data ["field_type" ] == "number"
53- assert data ["example" ] == 1299
5447
5548
5649def test_create_boolean_field (auth_client , sample_boolean_field ):
@@ -60,7 +53,6 @@ def test_create_boolean_field(auth_client, sample_boolean_field):
6053
6154 data = response .json ()
6255 assert data ["field_type" ] == "boolean"
63- assert data ["example" ] is True
6456
6557
6658def test_create_array_field (auth_client ):
@@ -69,15 +61,13 @@ def test_create_array_field(auth_client):
6961 name = "user_interests" ,
7062 description = "List of user interests" ,
7163 field_type = FieldType .array ,
72- example = ["sports" , "technology" , "music" ],
7364 )
7465
7566 response = auth_client .post ("/v1/fields/" , json = field_data .model_dump ())
7667 assert response .status_code == 201
7768
7869 data = response .json ()
7970 assert data ["field_type" ] == "array"
80- assert isinstance (data ["example" ], list )
8171
8272
8373def test_create_object_field (auth_client ):
@@ -86,32 +76,26 @@ def test_create_object_field(auth_client):
8676 name = "user_profile" ,
8777 description = "User profile object" ,
8878 field_type = FieldType .object ,
89- example = {"name" : "John" , "age" : 30 },
9079 )
9180
9281 response = auth_client .post ("/v1/fields/" , json = field_data .model_dump ())
9382 assert response .status_code == 201
9483
9584 data = response .json ()
9685 assert data ["field_type" ] == "object"
97- assert isinstance (data ["example" ], dict )
9886
9987
10088def test_create_integer_field (auth_client ):
10189 """Test creating integer field"""
10290 field_data = FieldCreate (
103- name = "user_age" ,
104- description = "User age in years" ,
105- field_type = FieldType .integer ,
106- example = 25 ,
91+ name = "user_age" , description = "User age in years" , field_type = FieldType .integer
10792 )
10893
10994 response = auth_client .post ("/v1/fields/" , json = field_data .model_dump ())
11095 assert response .status_code == 201
11196
11297 data = response .json ()
11398 assert data ["field_type" ] == "integer"
114- assert data ["example" ] == 25
11599
116100
117101# Test field operations
@@ -130,7 +114,7 @@ def test_list_fields_returns_all(auth_client):
130114
131115 fields = response .json ()
132116 assert isinstance (fields , list )
133- assert len (fields ) >= 2 # Should have at least our created fields
117+ assert len (fields ) >= 2 # Should have at least the previously created fields
134118
135119
136120def test_get_field_with_event_count (auth_client ):
@@ -159,7 +143,6 @@ def test_update_field(auth_client):
159143 name = "update_test_field" ,
160144 description = "Field to be updated" ,
161145 field_type = FieldType .string ,
162- example = "original" ,
163146 )
164147
165148 create_response = auth_client .post ("/v1/fields/" , json = create_data .model_dump ())
@@ -170,7 +153,6 @@ def test_update_field(auth_client):
170153 name = "update_test_field" , # Name should stay same due to unique constraint
171154 description = "Updated description" ,
172155 field_type = FieldType .string ,
173- example = "updated" ,
174156 )
175157
176158 update_response = auth_client .put (
@@ -180,7 +162,6 @@ def test_update_field(auth_client):
180162
181163 data = update_response .json ()
182164 assert data ["description" ] == "Updated description"
183- assert data ["example" ] == "updated"
184165
185166
186167def test_delete_field (auth_client ):
@@ -294,21 +275,6 @@ def test_create_field_without_description(auth_client):
294275 assert data ["description" ] is None
295276
296277
297- def test_create_field_without_example (auth_client ):
298- """Test creating field without optional example"""
299- field_data = FieldCreate (
300- name = "no_example_field" ,
301- description = "Field without example" ,
302- field_type = FieldType .string ,
303- )
304-
305- response = auth_client .post ("/v1/fields/" , json = field_data .model_dump ())
306- assert response .status_code == 201
307-
308- data = response .json ()
309- assert data ["example" ] is None
310-
311-
312278# Test authentication
313279def test_list_fields_requires_auth (client ):
314280 """Test that listing fields requires authentication"""
0 commit comments