Skip to content

Commit 7a2dd05

Browse files
committed
Test reading mulitple credential attributes
1 parent df3ecee commit 7a2dd05

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

win32ctypes/tests/test_win32cred.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,23 +38,26 @@ def setUp(self):
3838
except error:
3939
pass
4040

41-
def _demo_attributes(self):
41+
def _demo_attributes(self, multiple=False):
4242
keyword = 'mysecret-attribute'
4343
attribute1 = {
4444
'Keyword': keyword,
4545
'Value': b'Created by MiniPyWin32Cred test suite', 'Flags': 0}
4646
attribute2 = {
4747
'Keyword': keyword + '12',
4848
'Value': b'Attribute from MiniPyWin32', 'Flags': 0}
49-
return (attribute1,)
49+
if multiple:
50+
return (attribute1, attribute2)
51+
else:
52+
return (attribute1,)
5053

51-
def _demo_credentials(self, UserName=u'jone'):
54+
def _demo_credentials(self, UserName=u'jone', multiple=False):
5255
return {
5356
'Type': CRED_TYPE_GENERIC,
5457
'TargetName': u'jone@doe',
5558
'UserName': UserName,
5659
'CredentialBlob': u'doefsajfsakfj',
57-
'Attributes': self._demo_attributes(),
60+
'Attributes': self._demo_attributes(multiple),
5861
'Comment': u'Created by MiniPyWin32Cred test suite',
5962
'Persist': CRED_PERSIST_ENTERPRISE}
6063

@@ -87,8 +90,8 @@ def test_write_to_pywin32(self):
8790
def test_read_from_pywin32(self):
8891
# given
8992
target = u'jone@doe'
90-
r_credentials = self._demo_credentials()
91-
r_attributes = self._demo_attributes()
93+
r_credentials = self._demo_credentials(multiple=True)
94+
r_attributes = self._demo_attributes(multiple=True)
9295
win32cred.CredWrite(r_credentials)
9396

9497
# when

0 commit comments

Comments
 (0)