4 # ==================================================================================
5 # Copyright (c) 2019-2020 Nokia
6 # Copyright (c) 2018-2020 AT&T Intellectual Property.
8 # Licensed under the Apache License, Version 2.0 (the "License");
9 # you may not use this file except in compliance with the License.
10 # You may obtain a copy of the License at
12 # http://www.apache.org/licenses/LICENSE-2.0
14 # Unless required by applicable law or agreed to in writing, software
15 # distributed under the License is distributed on an "AS IS" BASIS,
16 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 # See the License for the specific language governing permissions and
18 # limitations under the License.
19 # ==================================================================================
21 from ricsdl.syncstorage import SyncStorage
25 """module level setup"""
26 data.SDL.sdl = SyncStorage(fake_db_backend="dict")
31 test raw sdl functions
33 data.SDL.set("as.df1", "data")
34 data.SDL.set("as.df2", "data2")
35 assert data.SDL.get("as.df1") == "data"
36 assert data.SDL.get("as.df2") == "data2"
37 assert data.SDL.find_and_get("as.df1") == {"as.df1": "data"}
38 assert data.SDL.find_and_get("as.df2") == {"as.df2": "data2"}
39 assert data.SDL.find_and_get("as.df") == {"as.df1": "data", "as.df2": "data2"}
40 assert data.SDL.find_and_get("as.d") == {"as.df1": "data", "as.df2": "data2"}
41 assert data.SDL.find_and_get("as.") == {"as.df1": "data", "as.df2": "data2"}
42 assert data.SDL.find_and_get("asd") == {}
45 data.SDL.delete("as.df1")
46 assert data.SDL.get("as.df1") is None
47 assert data.SDL.get("as.df2") == "data2"
50 data.SDL.delete("as.df2")
51 assert data.SDL.get("as.df2") is None
53 assert data.SDL.find_and_get("as.df") == {}
54 assert data.SDL.find_and_get("") == {}