@@ -108,6 +108,10 @@ def test_create_preset_3(self):
108
108
self .assertTrue (os .path .exists (f"{ PRESETS } /Foo Device/pre set 2.json" ))
109
109
self .assertTrue (os .path .exists (f"{ PRESETS } /Foo Device/pre set 3.json" ))
110
110
111
+ def test_create_preset_4 (self ):
112
+ create_preset ("Qux/Device?" , "bla" )
113
+ self .assertTrue (os .path .exists (f"{ PRESETS } /Qux_Device_/bla.json" ))
114
+
111
115
112
116
class TestDeletePreset (unittest .TestCase ):
113
117
def tearDown (self ):
@@ -127,6 +131,11 @@ def test_delete_preset(self):
127
131
# if no preset in the directory, remove the directory
128
132
self .assertFalse (os .path .exists (f"{ PRESETS } /Foo Device" ))
129
133
134
+ create_preset ("Qux/Device?" , "bla" )
135
+ self .assertTrue (os .path .exists (f"{ PRESETS } /Qux_Device_/bla.json" ))
136
+ delete_preset ("Qux/Device?" , "bla" )
137
+ self .assertFalse (os .path .exists (f"{ PRESETS } /Qux_Device_/bla.json" ))
138
+
130
139
131
140
class TestRenamePreset (unittest .TestCase ):
132
141
def tearDown (self ):
@@ -137,12 +146,18 @@ def test_rename_preset(self):
137
146
create_preset ("Foo Device" , "preset 1" )
138
147
create_preset ("Foo Device" , "preset 2" )
139
148
create_preset ("Foo Device" , "foobar" )
149
+ create_preset ("Qux/Device?" , "bla" )
150
+
140
151
rename_preset ("Foo Device" , "preset 1" , "foobar" )
141
152
rename_preset ("Foo Device" , "preset 2" , "foobar" )
153
+ rename_preset ("Qux/Device?" , "bla" , "blubb" )
154
+
142
155
self .assertFalse (os .path .exists (f"{ PRESETS } /Foo Device/preset 1.json" ))
143
156
self .assertTrue (os .path .exists (f"{ PRESETS } /Foo Device/foobar.json" ))
144
157
self .assertTrue (os .path .exists (f"{ PRESETS } /Foo Device/foobar 2.json" ))
145
158
self .assertTrue (os .path .exists (f"{ PRESETS } /Foo Device/foobar 3.json" ))
159
+ self .assertFalse (os .path .exists (f"{ PRESETS } /Qux_Device_/bla.json" ))
160
+ self .assertTrue (os .path .exists (f"{ PRESETS } /Qux_Device_/blubb.json" ))
146
161
147
162
148
163
class TestFindPresets (unittest .TestCase ):
@@ -152,6 +167,9 @@ def tearDown(self):
152
167
153
168
def test_get_presets (self ):
154
169
os .makedirs (os .path .join (PRESETS , "1234" ))
170
+ os .makedirs (f"{ PRESETS } /Qux_Device_" )
171
+ os .mknod (f"{ PRESETS } /Qux_Device_/blubb.json" )
172
+ self .assertEqual (len (get_presets ("Qux/Device?" )), 1 )
155
173
156
174
os .mknod (os .path .join (PRESETS , "1234" , "picture.png" ))
157
175
self .assertEqual (len (get_presets ("1234" )), 0 )
0 commit comments