1717def test_validation ():
1818 """Test validation of module attributes"""
1919 print ("Testing validation..." )
20-
20+
2121 module = DnfAppStreamPromiseTypeModule ()
22-
22+
2323 # Test valid attributes
2424 try :
2525 module .validate_promise ("nodejs" , {
@@ -29,7 +29,7 @@ def test_validation():
2929 print (" ✓ Valid attributes validation passed" )
3030 except Exception as e :
3131 print (f" ✗ Valid attributes validation failed: { e } " )
32-
32+
3333 # Test invalid module name
3434 try :
3535 module .validate_promise ("nodejs; rm -rf /" , {
@@ -40,17 +40,17 @@ def test_validation():
4040 print (f" ✓ Invalid module name validation passed: { e } " )
4141 except Exception as e :
4242 print (f" ? Unexpected exception for invalid module name: { e } " )
43-
43+
4444 # Note: Stream and State validation have been moved to attribute validators
4545 # which are handled by the library, not inside validate_promise directly.
4646 # Therefore we don't test them here via validate_promise, but in their specific test functions below.
4747
4848def test_module_name_validation ():
4949 """Test module name validation"""
5050 print ("\n Testing module name validation..." )
51-
51+
5252 module = DnfAppStreamPromiseTypeModule ()
53-
53+
5454 # Test valid names
5555 valid_names = ["nodejs" , "python3.6" , "python36" , "postgresql" , "maven" , "httpd" ]
5656 for name in valid_names :
@@ -59,7 +59,7 @@ def test_module_name_validation():
5959 print (f" ✓ Valid name '{ name } ' passed validation" )
6060 except Exception as e :
6161 print (f" ✗ Valid name '{ name } ' failed validation: { e } " )
62-
62+
6363 # Test invalid names
6464 invalid_names = ["nodejs;rm" , "python36&&" , "postgresql|" , "maven>" , "httpd<" ]
6565 for name in invalid_names :
@@ -72,9 +72,9 @@ def test_module_name_validation():
7272def test_stream_name_validation ():
7373 """Test stream name validation"""
7474 print ("\n Testing stream name validation..." )
75-
75+
7676 module = DnfAppStreamPromiseTypeModule ()
77-
77+
7878 # Test valid stream names
7979 valid_streams = ["12" , "14" , "3.6" , "1.14" , "latest" , "stable" ]
8080 for stream in valid_streams :
@@ -83,7 +83,7 @@ def test_stream_name_validation():
8383 print (f" ✓ Valid stream '{ stream } ' passed validation" )
8484 except Exception as e :
8585 print (f" ✗ Valid stream '{ stream } ' failed validation: { e } " )
86-
86+
8787 # Test invalid stream names
8888 invalid_streams = ["12;rm" , "14&&" , "3.6|" , "latest>" , "stable<" ]
8989 for stream in invalid_streams :
@@ -96,9 +96,9 @@ def test_stream_name_validation():
9696def test_state_validation ():
9797 """Test state validation"""
9898 print ("\n Testing state validation..." )
99-
99+
100100 module = DnfAppStreamPromiseTypeModule ()
101-
101+
102102 # Test valid states
103103 valid_states = ["enabled" , "disabled" , "installed" , "removed" ]
104104 for state in valid_states :
@@ -107,7 +107,7 @@ def test_state_validation():
107107 print (f" ✓ Valid state '{ state } ' passed validation" )
108108 except Exception as e :
109109 print (f" ✗ Valid state '{ state } ' failed validation: { e } " )
110-
110+
111111 # Test invalid states
112112 invalid_states = ["active" , "inactive" , "present" , "absent" , "enable" , "disable" ]
113113 for state in invalid_states :
@@ -122,9 +122,9 @@ def test_state_validation():
122122def test_state_parsing ():
123123 """Test parsing of module states from dnf output"""
124124 print ("\n Testing state parsing..." )
125-
125+
126126 module = DnfAppStreamPromiseTypeModule ()
127-
127+
128128 # Test that the method exists and can be called
129129 try :
130130 # We can't easily test the actual parsing without mocking dnf,
@@ -136,11 +136,11 @@ def test_state_parsing():
136136
137137if __name__ == "__main__" :
138138 print ("Running tests for dnf_appstream promise type..." )
139-
139+
140140 test_validation ()
141141 test_module_name_validation ()
142142 test_stream_name_validation ()
143143 test_state_validation ()
144144 test_state_parsing ()
145-
145+
146146 print ("\n All tests completed." )
0 commit comments