Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Minor updates to test_hash

  • Loading branch information...
commit fd5edc7d61c502a9992b171bc038e7b378da2ebe 1 parent 043bd0a
@kfdm authored
Showing with 10 additions and 19 deletions.
  1. +10 −19 { → gntp}/test/test_hash.py
View
29 test/test_hash.py → gntp/test/test_hash.py 100755 → 100644
@@ -7,21 +7,15 @@
script. Please fill out your ~/.gntp config before running
"""
import os
-import unittest
-from gntp.config import GrowlNotifier
+from gntp.test import GNTPTestCase
from gntp import UnsupportedError
-class Growler(GrowlNotifier):
- def hash_test(self, hashName):
- self.passwordHash = hashName
- return self.notify('Testing', 'Testing Hash', hashName)
+class TestHash(GNTPTestCase):
-
-class TestHash(unittest.TestCase):
- def setUp(self):
- self.growl = Growler('GNTP unittest', ['Testing'])
- self.growl.register()
+ def _hash(self, hashName):
+ self.growl.passwordHash = hashName
+ return self._notify(description=hashName)
def test_config(self):
"""Test to see if our config file exists
@@ -33,20 +27,17 @@ def test_config(self):
self.assertTrue(os.path.exists(config))
def test_md5(self):
- self.assertTrue(self.growl.hash_test('MD5'))
+ self.assertTrue(self._hash('MD5'))
def test_sha1(self):
- self.assertTrue(self.growl.hash_test('SHA1'))
+ self.assertTrue(self._hash('SHA1'))
def test_sha256(self):
- self.assertTrue(self.growl.hash_test('SHA256'))
+ self.assertTrue(self._hash('SHA256'))
def test_sha512(self):
- self.assertTrue(self.growl.hash_test('SHA512'))
+ self.assertTrue(self._hash('SHA512'))
def test_fake(self):
'''Fake hash should not work'''
- self.assertRaises(UnsupportedError, self.growl.hash_test, 'fake-hash')
-
-if __name__ == '__main__':
- unittest.main()
+ self.assertRaises(UnsupportedError, self._hash, 'fake-hash')
Please sign in to comment.
Something went wrong with that request. Please try again.