@@ -62,6 +62,18 @@ def getModel(self):
62
62
63
63
return model
64
64
65
+ def getModelWithoutMockEnv (self ):
66
+ # Load model as dictionary
67
+ file = open (r'../resources/model.dynamic_cluster_dict.txt' )
68
+ contents = file .read ()
69
+ model = ast .literal_eval (contents )
70
+ file .close ()
71
+
72
+ # Setup environment
73
+ model_wdt_mii_filter .initOfflineWlstEnv (model )
74
+
75
+ return model
76
+
65
77
def getStaticModel (self ):
66
78
# Load model as dictionary
67
79
file = open (r'../resources/model.static_cluster_dict.txt' )
@@ -371,6 +383,44 @@ def test_customizeIstioReplicationChannel_version_1_10(self):
371
383
del os .environ ['ISTIO_ENABLED' ]
372
384
del os .environ ['ISTIO_USE_LOCALHOST_BINDINGS' ]
373
385
386
+ def test_isSecureModeEnabledForDomain_secureModeEnabled (self ):
387
+ model = self .getModel ()
388
+ topology = model ['topology' ]
389
+ if 'SecurityConfiguration' not in topology :
390
+ topology ['SecurityConfiguration' ] = {}
391
+
392
+ if 'SecureMode' not in topology ['SecurityConfiguration' ]:
393
+ topology ['SecurityConfiguration' ]['SecureMode' ] = {}
394
+
395
+ topology ['SecurityConfiguration' ]['SecureMode' ]['SecureModeEnabled' ] = 'true'
396
+
397
+ isSecureModeEnabled = model_wdt_mii_filter .isSecureModeEnabledForDomain (topology )
398
+ self .assertTrue (isSecureModeEnabled , "Expected secure mode enabled for domain" )
399
+
400
+ def test_isSecureModeEnabledForDomain_productionModeEnabled (self ):
401
+ model = self .getModel ()
402
+ topology = model ['topology' ]
403
+
404
+ topology ['ProductionModeEnabled' ] = 'true'
405
+
406
+ isSecureModeEnabled = model_wdt_mii_filter .isSecureModeEnabledForDomain (topology )
407
+ self .assertTrue (isSecureModeEnabled , "Expected secure mode enabled for domain" )
408
+
409
+ def test_isSecureModeEnabledForDomain_importLegalHelperError (self ):
410
+ try :
411
+ model = self .getModelWithoutMockEnv ()
412
+ topology = model ['topology' ]
413
+
414
+ topology ['ProductionModeEnabled' ] = 'true'
415
+
416
+ isSecureModeEnabled = model_wdt_mii_filter .isSecureModeEnabledForDomain (topology )
417
+ self .fail ("Expected import error for LegalHelper" )
418
+ except ImportError , ie :
419
+ self .assertTrue (ie is not None )
420
+
421
+
422
+
423
+
374
424
class MockOfflineWlstEnv (model_wdt_mii_filter .OfflineWlstEnv ):
375
425
376
426
WLS_CRED_USERNAME = 'weblogic'
@@ -388,5 +438,8 @@ def readFile(self, path):
388
438
389
439
return self .WLS_CRED_PASSWORD
390
440
441
+ def wlsVersionEarlierThan (self , version ):
442
+ return False
443
+
391
444
if __name__ == '__main__' :
392
445
unittest .main ()
0 commit comments