Skip to content
This repository has been archived by the owner on Jul 10, 2021. It is now read-only.

Commit

Permalink
Minor updates to test_hash
Browse files Browse the repository at this point in the history
  • Loading branch information
kfdm committed Feb 26, 2012
1 parent 043bd0a commit fd5edc7
Showing 1 changed file with 10 additions and 19 deletions.
29 changes: 10 additions & 19 deletions test/test_hash.py → gntp/test/test_hash.py 100755 → 100644
Expand Up @@ -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
Expand All @@ -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')

0 comments on commit fd5edc7

Please sign in to comment.