@@ -98,18 +98,18 @@ def test_reset(r):
9898 assert r .execute_command ("SM.CURRENT" , "foostates" ) == initial
9999
100100
101- def test_force_set (r ):
102- r .flushdb ()
103- initial = "begin"
104- mapstates = {
105- "a" : ["this" , "maps" , "states" ],
106- "b" : ["this" , "too" , "maps" , "somewhere" ],
107- }
108- validmap = {"initial" : initial , "map" : mapstates , "current" : "maps" }
109- assert r .execute_command ("SM.SET" , "foostates" , json .dumps (validmap ))
110- assert r .execute_command ("SM.FORCE" , "foostates" , "too" )
101+ # def test_force_set(r):
102+ # r.flushdb()
103+ # initial = "begin"
104+ # mapstates = {
105+ # "a": ["this", "maps", "states"],
106+ # "b": ["this", "too", "maps", "somewhere"],
107+ # }
108+ # validmap = {"initial": initial, "map": mapstates, "current": "maps"}
109+ # assert r.execute_command("SM.SET", "foostates", json.dumps(validmap))
110+ # assert r.execute_command("SM.FORCE", "foostates", "too")
111111
112- assert r .execute_command ("SM.CURRENT" , "foostates" ) == "too"
112+ # assert r.execute_command("SM.CURRENT", "foostates") == "too"
113113
114114
115115def test_create (r ):
@@ -133,3 +133,24 @@ def test_template(r):
133133 assert val ["initial" ] == ""
134134 assert val ["map" ] == {}
135135 assert val ["current" ] == ""
136+
137+ def test_transition (r ):
138+ r .flushdb ()
139+ initial = "begin"
140+ current = "begin"
141+ mapstates = {
142+ "a" : ["this" , "maps" , "states" ],
143+ "b" : ["this" , "too" , "maps" , "somewhere" ],
144+ "begin" : ["too" , "maps" ],
145+ }
146+
147+ valid_with_current = {"initial" : initial , "map" : mapstates , "current" : current }
148+ assert r .execute_command ("SM.SET" , "bar" , json .dumps (valid_with_current ))
149+ assert r .execute_command ("SM.TRANSITION" , "bar" , "smurfy" ) == None
150+ assert r .execute_command ("SM.TRANSITION" , "bar" , "too" )
151+
152+ # force state
153+ r .flushdb ()
154+ assert r .execute_command ("SM.SET" , "bar" , json .dumps (valid_with_current ))
155+ assert r .execute_command ("SM.TRANSITION" , "bar" , "banna" , "foo" ) == None
156+ assert r .execute_command ("SM.TRANSITION" , "bar" , "banna" , "F" )
0 commit comments