Skip to content

Commit 3f7b0d2

Browse files
authored
Merge pull request #266 from oracle/WDT-250-add-a-unit-test-for-encrypted-password
Wdt 250 add a unit test for encrypted password
2 parents 30db61a + e54532c commit 3f7b0d2

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

core/src/test/python/alias_password_test.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
from wlsdeploy.aliases.model_constants import PASSWORD_ENCRYPTED
1414
from wlsdeploy.aliases.wlst_modes import WlstModes
1515
from wlsdeploy.logging.platform_logger import PlatformLogger
16+
from wlsdeploy.util.cla_utils import CommandLineArgUtil
1617
from wlsdeploy.util.model_context import ModelContext
1718

1819

@@ -23,12 +24,14 @@ class AliasPasswordTestCase(unittest.TestCase):
2324
_wlst_password_name = "Password"
2425
_wlst_password_encrypted_name = "PasswordEncrypted"
2526

27+
_passphrase = 'RE a drop of golden sun'
2628
_password = 'welcome1'
27-
_encrypted_password = '{AES}BR5Lw+UuwM4ZmFcTu2GX5C2w0Jcr6E30uhZvhoyXjYU='
29+
_encrypted_password = '{AES}UC9rZld3blZFUnMraW12cHkydmtmdmpSZmNNMWVHajA6VERPYlJoeWxXU09IaHVrQzpBeWsrd2ZacVkyVT0='
2830
_encrypted_password_bytes = jarray.array(_encrypted_password, 'b')
2931

3032
def setUp(self):
31-
model_context = ModelContext("test", {})
33+
model_context = ModelContext("test", {CommandLineArgUtil.USE_ENCRYPTION_SWITCH: 'true',
34+
CommandLineArgUtil.PASSPHRASE_SWITCH: self._passphrase})
3235
self.aliases = Aliases(model_context, wlst_mode=WlstModes.OFFLINE, wls_version=self._wls_version)
3336
self.online_aliases = Aliases(model_context, wlst_mode=WlstModes.ONLINE, wls_version=self._wls_version)
3437

@@ -70,6 +73,7 @@ def testOfflineWlstNames(self):
7073
wlst_name, wlst_value = \
7174
self.aliases.get_wlst_attribute_name_and_value(self.location, PASSWORD_ENCRYPTED, self._encrypted_password)
7275
self.assertEqual(wlst_name, self._wlst_password_encrypted_name)
76+
self.assertEqual(wlst_value, self._password)
7377

7478
# using unencrypted password
7579
wlst_name, wlst_value = \
@@ -85,6 +89,7 @@ def testOnlineWlstNames(self):
8589
self.online_aliases.get_wlst_attribute_name_and_value(self.location, PASSWORD_ENCRYPTED,
8690
self._encrypted_password)
8791
self.assertEqual(wlst_name, self._wlst_password_encrypted_name)
92+
self.assertEqual(wlst_value, self._password)
8893

8994
# using unencrypted password
9095
wlst_name, wlst_value = \

0 commit comments

Comments
 (0)