88
99class TestEdgeLicenses (base_edge .BaseEdgeTest ):
1010
11+ def setUp (self ):
12+ super ().setUp ()
13+ self ._local_license = 'MA645-83CDC-50127-CE61B-V64'
14+
1115 def test_edge_get_active_licenses (self ):
1216 actual_licenses = ['NA' , 'vGateway8' , 'vGateway' , 'vGateway32' , 'vGateway64' , 'vGateway128' ]
1317 expected_licenses = ['NA' , 'EV8' , 'EV16' , 'EV32' , 'EV64' , 'EV128' ]
@@ -32,3 +36,22 @@ def test_apply_license_raise_input_error(self):
3236 with self .assertRaises (exception .InputError ) as error :
3337 licenses .Licenses (self ._filer ).apply ('Expected Failure' )
3438 self .assertEqual ('Invalid license type' , error .exception .message )
39+
40+ def test_get_local_license (self ):
41+ get_response = [self ._local_license ]
42+ self ._init_filer (get_response = get_response )
43+ ret = licenses .Licenses (self ._filer ).local .get ()
44+ self ._filer .get .assert_called_once_with ('/config/device/licenses' )
45+ self .assertEqual (ret , get_response )
46+
47+ def test_apply_local_license (self ):
48+ add_response = 'Success'
49+ self ._init_filer (add_response = add_response )
50+ ret = licenses .Licenses (self ._filer ).local .add (self ._local_license )
51+ self ._filer .add .assert_called_once_with ('/config/device/licenses' , self ._local_license )
52+ self .assertEqual (ret , add_response )
53+
54+ def test_clear_local_license (self ):
55+ self ._init_filer ()
56+ licenses .Licenses (self ._filer ).local .clear ()
57+ self ._filer .put .assert_called_once_with ('/config/device/licenses' , [])
0 commit comments