This repository was archived by the owner on Jun 3, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change 9
9
10
10
UUID = "store-test-{}" .format (uuid .uuid4 ().hex )
11
11
12
+
12
13
@pytest .fixture (scope = "module" )
13
14
def store_app ():
14
15
app = dash .Dash (__name__ )
@@ -30,6 +31,8 @@ def store_app():
30
31
[State ("memory" , "data" )],
31
32
)
32
33
def write_memory (modified_ts , data ):
34
+ if data is None :
35
+ return ""
33
36
return json .dumps (data )
34
37
35
38
@app .callback (
@@ -43,7 +46,7 @@ def write_memory(modified_ts, data):
43
46
def on_clear (n_clicks ):
44
47
if n_clicks is None :
45
48
raise PreventUpdate
46
- return True
49
+ return True , True , True
47
50
48
51
@app .callback (
49
52
[
Original file line number Diff line number Diff line change
1
+ def test_stcd001_clear_data_on_all_types (store_app , dash_duo ):
2
+
3
+ dash_duo .start_server (store_app )
4
+
5
+ assert dash_duo .wait_for_contains_text ("#output" , store_app .uuid )
6
+
7
+ dash_duo .multiple_click ("#btn" , 3 )
8
+ assert dash_duo .local_storage == {"n_clicks" : 3 }
9
+
10
+ dash_duo .find_element ("#clear-btn" ).click ()
11
+
12
+ assert (
13
+ not dash_duo .find_element ("#output" ).text
14
+ and not dash_duo .local_storage
15
+ and not dash_duo .session_storage
16
+ ), "the clear_data should clear all data in three storage types"
You can’t perform that action at this time.
0 commit comments