@@ -120,12 +120,8 @@ def test_add_asset_video_upload(self, page, live_server):
120120 page .click ('[data-bs-target="#addAssetModal"]' )
121121 page .wait_for_selector ('#addAssetModal.show' )
122122 page .click ('[data-bs-target="#tab-upload"]' )
123- page .set_input_files (
124- '#add-file-upload' , video_file
125- )
126- page .click (
127- '#addAssetForm button[type="submit"]'
128- )
123+ page .set_input_files ('#add-file-upload' , video_file )
124+ page .click ('#addAssetForm button[type="submit"]' )
129125 page .wait_for_timeout (3000 )
130126
131127 assets = Asset .objects .all ()
@@ -137,9 +133,7 @@ def test_add_asset_video_upload(self, page, live_server):
137133
138134 def test_add_two_assets_upload (self , page , live_server ):
139135 with (
140- TemporaryCopy (
141- 'tests/assets/asset.mov' , 'video.mov'
142- ) as video_file ,
136+ TemporaryCopy ('tests/assets/asset.mov' , 'video.mov' ) as video_file ,
143137 TemporaryCopy (
144138 'static/img/standby.png' , 'standby.png'
145139 ) as image_file ,
@@ -149,33 +143,22 @@ def test_add_two_assets_upload(self, page, live_server):
149143 page .wait_for_selector ('#addAssetModal.show' )
150144 page .click ('[data-bs-target="#tab-upload"]' )
151145
152- page .set_input_files (
153- '#add-file-upload' , image_file
154- )
155- page .click (
156- '#addAssetForm button[type="submit"]'
157- )
146+ page .set_input_files ('#add-file-upload' , image_file )
147+ page .click ('#addAssetForm button[type="submit"]' )
158148 page .wait_for_timeout (2000 )
159149
160150 page .click ('[data-bs-target="#addAssetModal"]' )
161151 page .wait_for_selector ('#addAssetModal.show' )
162152 page .click ('[data-bs-target="#tab-upload"]' )
163- page .set_input_files (
164- '#add-file-upload' , video_file
165- )
166- page .click (
167- '#addAssetForm button[type="submit"]'
168- )
153+ page .set_input_files ('#add-file-upload' , video_file )
154+ page .click ('#addAssetForm button[type="submit"]' )
169155 page .wait_for_timeout (3000 )
170156
171157 assets = Asset .objects .all ()
172158 assert len (assets ) == 2
173159 assert assets [0 ].name == 'standby.png'
174160 assert assets [0 ].mimetype == 'image'
175- assert (
176- assets [0 ].duration
177- == settings ['default_duration' ]
178- )
161+ assert assets [0 ].duration == settings ['default_duration' ]
179162 assert assets [1 ].name == 'video.mov'
180163 assert assets [1 ].mimetype == 'video'
181164 assert assets [1 ].duration == 5
@@ -184,22 +167,16 @@ def test_add_asset_streaming(self, page, live_server):
184167 page .goto (live_server .url )
185168 page .click ('[data-bs-target="#addAssetModal"]' )
186169 page .wait_for_selector ('#addAssetModal.show' )
187- page .fill (
188- '#add-uri' , 'rtsp://localhost:8091/asset.mov'
189- )
170+ page .fill ('#add-uri' , 'rtsp://localhost:8091/asset.mov' )
190171 page .check ('#add-skip-check' )
191172 page .click ('#addAssetForm button[type="submit"]' )
192173 page .wait_for_timeout (3000 )
193174
194175 assets = Asset .objects .all ()
195176 assert len (assets ) == 1
196177 asset = assets .first ()
197- assert (
198- asset .name == 'rtsp://localhost:8091/asset.mov'
199- )
200- assert (
201- asset .uri == 'rtsp://localhost:8091/asset.mov'
202- )
178+ assert asset .name == 'rtsp://localhost:8091/asset.mov'
179+ assert asset .uri == 'rtsp://localhost:8091/asset.mov'
203180 assert asset .mimetype == 'streaming'
204181
205182 def test_remove_asset (self , page , live_server ):
@@ -230,9 +207,7 @@ def test_enable_asset(self, page, live_server):
230207 assert assets .first ().is_enabled is True
231208
232209 def test_disable_asset (self , page , live_server ):
233- Asset .objects .create (
234- ** {** asset_x , 'is_enabled' : 1 }
235- )
210+ Asset .objects .create (** {** asset_x , 'is_enabled' : 1 })
236211 page .goto (live_server .url )
237212 page .wait_for_selector ('[data-asset-id]' )
238213 toggle = page .locator (
@@ -246,20 +221,16 @@ def test_disable_asset(self, page, live_server):
246221 assert assets .first ().is_enabled is False
247222
248223 def test_reorder_asset (self , page , live_server ):
249- Asset .objects .create (
250- ** {** asset_x , 'is_enabled' : 1 }
251- )
224+ Asset .objects .create (** {** asset_x , 'is_enabled' : 1 })
252225 Asset .objects .create (** asset_y )
253226 page .goto (live_server .url )
254227 page .wait_for_selector ('[data-asset-id]' )
255228
256229 source = page .locator (
257- f'[data-asset-id="{ asset_x ["asset_id" ]} "]'
258- ' .drag-handle'
230+ f'[data-asset-id="{ asset_x ["asset_id" ]} "] .drag-handle'
259231 )
260232 target = page .locator (
261- f'[data-asset-id="{ asset_y ["asset_id" ]} "]'
262- ' .drag-handle'
233+ f'[data-asset-id="{ asset_y ["asset_id" ]} "] .drag-handle'
263234 )
264235 source .drag_to (target )
265236 page .wait_for_timeout (3000 )
@@ -269,27 +240,15 @@ def test_reorder_asset(self, page, live_server):
269240 assert x .play_order == 0
270241 assert y .play_order == 1
271242
272- def test_settings_page_should_work (
273- self , page , live_server
274- ):
243+ def test_settings_page_should_work (self , page , live_server ):
275244 page .goto (f'{ live_server .url } /settings' )
276245 content = page .content ()
277- assert (
278- 'Error: 500 Internal Server Error' not in content
279- )
280- assert (
281- 'Error: 504 Gateway Time-out' not in content
282- )
283- assert (
284- 'Error: 504 Gateway Timeout' not in content
285- )
246+ assert 'Error: 500 Internal Server Error' not in content
247+ assert 'Error: 504 Gateway Time-out' not in content
248+ assert 'Error: 504 Gateway Timeout' not in content
286249
287- def test_system_info_page_should_work (
288- self , page , live_server
289- ):
250+ def test_system_info_page_should_work (self , page , live_server ):
290251 page .goto (f'{ live_server .url } /system_info' )
291252 expect (
292- page .locator (
293- 'text=Error: 500 Internal Server Error'
294- )
253+ page .locator ('text=Error: 500 Internal Server Error' )
295254 ).not_to_be_visible ()
0 commit comments