@ -1,7 +1,9 @@
import os
import threading
import threading
import time
import time
import tempfile
import tempfile
import shutil
import shutil
import uuid
import unittest
import unittest
from common . params import Params , ParamKeyType , UnknownKeyName , put_nonblocking , put_bool_nonblocking
from common . params import Params , ParamKeyType , UnknownKeyName , put_nonblocking , put_bool_nonblocking
@ -28,9 +30,16 @@ class TestParams(unittest.TestCase):
self . params . put ( " CarParams " , " test " )
self . params . put ( " CarParams " , " test " )
self . params . put ( " DongleId " , " cb38263377b873ee " )
self . params . put ( " DongleId " , " cb38263377b873ee " )
assert self . params . get ( " CarParams " ) == b " test "
assert self . params . get ( " CarParams " ) == b " test "
undefined_param = self . params . get_param_path ( uuid . uuid4 ( ) . hex )
with open ( undefined_param , " w " ) as f :
f . write ( " test " )
assert os . path . isfile ( undefined_param )
self . params . clear_all ( ParamKeyType . CLEAR_ON_MANAGER_START )
self . params . clear_all ( ParamKeyType . CLEAR_ON_MANAGER_START )
assert self . params . get ( " CarParams " ) is None
assert self . params . get ( " CarParams " ) is None
assert self . params . get ( " DongleId " ) is not None
assert self . params . get ( " DongleId " ) is not None
assert not os . path . isfile ( undefined_param )
def test_params_two_things ( self ) :
def test_params_two_things ( self ) :
self . params . put ( " DongleId " , " bob " )
self . params . put ( " DongleId " , " bob " )