summaryrefslogtreecommitdiff
path: root/tests/utils/test_text_util.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/utils/test_text_util.py')
-rw-r--r--tests/utils/test_text_util.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/tests/utils/test_text_util.py b/tests/utils/test_text_util.py
index dc3de85..6f204c7 100644
--- a/tests/utils/test_text_util.py
+++ b/tests/utils/test_text_util.py
@@ -23,12 +23,16 @@ from azurelinuxagent.common.future import ustr
import azurelinuxagent.common.utils.textutil as textutil
from azurelinuxagent.common.utils.textutil import Version
+
class TestTextUtil(AgentTestCase):
def test_get_password_hash(self):
- password_hash = textutil.gen_password_hash("asdf", 6, 10)
- self.assertNotEquals(None, password_hash)
- password_hash = textutil.gen_password_hash("asdf", 6, 0)
- self.assertNotEquals(None, password_hash)
+ with open(os.path.join(os.path.dirname(os.path.realpath(__file__)), 'test_passwords.txt'), 'rb') as in_file:
+ for data in in_file:
+ # Remove bom on bytes data before it is converted into string.
+ data = textutil.remove_bom(data)
+ data = ustr(data, encoding='utf-8')
+ password_hash = textutil.gen_password_hash(data, 6, 10)
+ self.assertNotEquals(None, password_hash)
def test_remove_bom(self):
#Test bom could be removed