@@ -41,7 +41,7 @@ def test_set_get(r):
4141 assert bar == valid_with_current
4242
4343
44- def test_get_current (r ):
44+ def test_get_current_state (r ):
4545 r .flushdb ()
4646 initial = "begin"
4747 mapstates = {
@@ -50,7 +50,7 @@ def test_get_current(r):
5050 }
5151 validmap = {"initial" : initial , "map" : mapstates , "current" : "begin" }
5252 assert r .execute_command ("SM.SET" , "fooforcurrent" , json .dumps (validmap ))
53- assert r .execute_command ("SM.CURRENT " , "fooforcurrent" ) == "begin"
53+ assert r .execute_command ("SM.STATE " , "fooforcurrent" ) == [ "begin" ]
5454
5555
5656def test_get_states (r ):
@@ -62,7 +62,7 @@ def test_get_states(r):
6262 }
6363 validmap = {"initial" : initial , "map" : mapstates , "current" : "too" }
6464 assert r .execute_command ("SM.SET" , "foostates" , json .dumps (validmap ))
65- states = r .execute_command ("SM.STATES " , "foostates" )
65+ states = r .execute_command ("SM.STATE " , "foostates" , "list " )
6666
6767 mapkeys = list (mapstates .keys ())
6868 mapkeys .sort ()
@@ -79,7 +79,7 @@ def test_set_del(r):
7979 }
8080 validmap = {"initial" : initial , "map" : mapstates , "current" : "shmm" }
8181 assert r .execute_command ("SM.SET" , "foostates" , json .dumps (validmap ))
82- assert r .execute_command ( "SM.DEL" , "foostates" )
82+ assert r .delete ( "foostates" )
8383
8484 keys = r .keys ()
8585 assert "foostates" not in keys
@@ -95,46 +95,29 @@ def test_reset(r):
9595 validmap = {"initial" : initial , "map" : mapstates , "current" : "too" }
9696 assert r .execute_command ("SM.SET" , "foostates" , json .dumps (validmap ))
9797 r .execute_command ("SM.RESET" , "foostates" )
98- assert r .execute_command ("SM.CURRENT" , "foostates" ) == initial
99-
100-
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")
111-
112- # assert r.execute_command("SM.CURRENT", "foostates") == "too"
98+ assert r .execute_command ("SM.STATE" , "foostates" ) == [initial ]
11399
114100
115101def test_create (r ):
116102 r .flushdb ()
117103 key = "foo"
118104 assert r .execute_command ("SM.CREATE" , key )
119- assert r .execute_command ("SM.CURRENT " , key ) == ""
105+ assert r .execute_command ("SM.STATE " , key ) == [ '' ]
120106 res = r .execute_command ("SM.GET" , key )
121107 val = json .loads (res )
122108 assert val ["initial" ] == ""
123109 assert val ["map" ] == {}
124110 assert val ["current" ] == ""
125111
126112
127- # r.execute_command("SM.FORCE", "foostates", "too")
128-
129-
130113def test_template (r ):
131114 res = r .execute_command ("SM.TEMPLATE" )
132115 val = json .loads (res )
133116 assert val ["initial" ] == ""
134117 assert val ["map" ] == {}
135118 assert val ["current" ] == ""
136119
137- def test_transition (r ):
120+ def test_mutate (r ):
138121 r .flushdb ()
139122 initial = "begin"
140123 current = "begin"
@@ -146,11 +129,11 @@ def test_transition(r):
146129
147130 valid_with_current = {"initial" : initial , "map" : mapstates , "current" : current }
148131 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" )
132+ assert r .execute_command ("SM.MUTATE " , "bar" , "smurfy" ) == None
133+ assert r .execute_command ("SM.MUTATE " , "bar" , "too" )
151134
152135 # force state
153136 r .flushdb ()
154137 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" )
138+ assert r .execute_command ("SM.MUTATE " , "bar" , "banna" , "foo" ) == None
139+ assert r .execute_command ("SM.MUTATE " , "bar" , "banna" , "F" )
0 commit comments