File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import pytest
22
33from userlist .resources .company import Company
4+ from userlist .resources .relationship import Relationship
45
56
67def test_company_creation_with_basic_fields ():
@@ -28,3 +29,9 @@ def test_company_creation_with_none_data():
2829def test_company_creation_with_string ():
2930 company = Company ("company-123" )
3031 assert company .data ["identifier" ] == "company-123"
32+
33+
34+ def test_company_missing_attr ():
35+ company = Company ({"identifier" : "company-123" })
36+ with pytest .raises (AttributeError ):
37+ _ = company .non_existent_attribute
Original file line number Diff line number Diff line change @@ -28,3 +28,9 @@ def test_event_creation_with_all_fields():
2828def test_event_creation_with_none_data ():
2929 with pytest .raises (ValueError , match = "data parameter is required" ):
3030 Event (None )
31+
32+
33+ def test_event_missing_attr ():
34+ event = Event ({"name" : "logged_in" })
35+ with pytest .raises (AttributeError ):
36+ _ = event .non_existent_attribute
Original file line number Diff line number Diff line change @@ -25,3 +25,9 @@ def test_message_creation_with_all_fields():
2525def test_message_creation_with_none_data ():
2626 with pytest .raises (ValueError , match = "data parameter is required" ):
2727 Message (None )
28+
29+
30+ def test_message_missing_attr ():
31+ message = Message ({"template" : "welcome_email" })
32+ with pytest .raises (AttributeError ):
33+ _ = message .non_existent_attribute
Original file line number Diff line number Diff line change @@ -24,3 +24,9 @@ def test_relationship_creation_with_all_fields():
2424def test_relationship_creation_with_none_data ():
2525 with pytest .raises (ValueError , match = "data parameter is required" ):
2626 Relationship (None )
27+
28+
29+ def test_relationship_missing_attr ():
30+ relationship = Relationship ({"user" : "user-123" , "company" : "company-123" })
31+ with pytest .raises (AttributeError ):
32+ _ = relationship .non_existent_attribute
Original file line number Diff line number Diff line change @@ -27,3 +27,9 @@ def test_user_creation_with_none_data():
2727def test_user_creation_with_string ():
2828 user = User ("user-123" )
2929 assert user .identifier == "user-123"
30+
31+
32+ def test_user_missing_attr ():
33+ user = User ({"identifier" : "user-123" })
34+ with pytest .raises (AttributeError ):
35+ _ = user .non_existent_attribute
You can’t perform that action at this time.
0 commit comments