def test_get(): ss = UserStateStorage() ss.clear() state = ss.get("app.handlers.admin", "*****@*****.**") assert_equal(state, ROUTE_FIRST_STATE) ss.set("app.handlers.admin", "*****@*****.**", "POSTING") state = ss.get("app.handlers.admin", "*****@*****.**") assert_equal(state, "POSTING")
def test_set(): ss = UserStateStorage() # start states should not be stored ss.set("app.handlers.admin", "*****@*****.**", "START") assert_equal(len(UserState.objects.all()), 0) ss.set("app.handlers.admin", "*****@*****.**", "POSTING") assert_equal(len(UserState.objects.all()), 1) ss.clear()
def test_clear(): ss = UserStateStorage() ss.clear() assert_equal(len(UserState.objects.all()), 0)