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

Commit

Permalink
Initial work to convert into proper test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
kfdm committed Sep 15, 2011
1 parent 9ee076d commit 572e087
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 25 deletions.
Empty file added test/__init__.py
Empty file.
14 changes: 0 additions & 14 deletions test/hash.py

This file was deleted.

34 changes: 34 additions & 0 deletions test/test_hash.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/usr/bin/env python
# Test the various hashing methods
import unittest
import logging
logging.basicConfig(level=logging.WARNING)
import gntp.notifier

class Growler(gntp.notifier.GrowlNotifier):
applicationName = 'GNTP unittest'
hostname = 'localhost'
port = 23053
notifications=['Testing']
def hash_test(self,hashName):
self.passwordHash = hashName
return self.notify('Testing','Testing Hash',hashName)

class TestHash(unittest.TestCase):
def setUp(self):
self.growl = Growler()
self.growl.register()
def test_md5(self):
self.assertTrue( self.growl.hash_test('MD5') )
def test_sha1(self):
self.assertTrue( self.growl.hash_test('SHA1') )
def test_sha256(self):
self.assertTrue( self.growl.hash_test('SHA256') )
def test_sha512(self):
self.assertTrue( self.growl.hash_test('512') )
def test_fake(self):
'''Fake hash should not work'''
self.assertFalse( self.growl.hash_test('fake-hash') )

if __name__ == '__main__':
unittest.main()
27 changes: 27 additions & 0 deletions test/test_utf8.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Simple script to test sending UTF8 text with the GrowlNotifier class
import unittest
import logging
logging.basicConfig(level=logging.WARNING)
import gntp.notifier

class Growler(gntp.notifier.GrowlNotifier):
applicationName = 'GNTP unittest'
hostname = 'localhost'
port = 23053
notifications=['Testing']

class TestHash(unittest.TestCase):
def setUp(self):
self.growl = Growler()
self.growl.register()
def test_english(self):
self.growl.notify('Testing','Testing','Hello')
def test_extra(self):
self.growl.notify('Testing','Testing','allô')
def test_japanese(self):
self.growl.notify('Testing','Testing',u'おはおう')

if __name__ == '__main__':
unittest.main()
11 changes: 0 additions & 11 deletions test/utf8.py

This file was deleted.

0 comments on commit 572e087

Please sign in to comment.