aboutsummaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/LICENSE_HEADER10
-rw-r--r--common/PubnubBase.py12
-rw-r--r--common/PubnubCore.py20
-rw-r--r--common/PubnubCoreAsync.py18
-rw-r--r--common/PubnubCrypto.py12
-rw-r--r--common/PubnubUnitTest.py36
6 files changed, 46 insertions, 62 deletions
diff --git a/common/LICENSE_HEADER b/common/LICENSE_HEADER
new file mode 100644
index 0000000..a83793d
--- /dev/null
+++ b/common/LICENSE_HEADER
@@ -0,0 +1,10 @@
+## www.pubnub.com - PubNub Real-time push service in the cloud.
+# coding=utf8
+
+## PubNub Real-time Push APIs and Notifications Framework
+## Copyright (c) 2010 Stephen Blum
+## http://www.pubnub.com/
+
+## -----------------------------------
+## PubNub 3.3.4 Real-time Push Cloud API
+## -----------------------------------
diff --git a/common/PubnubBase.py b/common/PubnubBase.py
index 0c4efef..64d43ed 100644
--- a/common/PubnubBase.py
+++ b/common/PubnubBase.py
@@ -1,14 +1,3 @@
-## www.pubnub.com - PubNub Real-time push service in the cloud.
-# coding=utf8
-
-## PubNub Real-time Push APIs and Notifications Framework
-## Copyright (c) 2010 Stephen Blum
-## http://www.pubnub.com/
-
-## -----------------------------------
-## PubNub 3.3.4 Real-time Push Cloud API
-## -----------------------------------
-
try: import json
except ImportError: import simplejson as json
@@ -16,7 +5,6 @@ import time
import hashlib
import urllib2
import uuid
-from PubnubCrypto import PubnubCrypto
class PubnubBase(object):
def __init__(
diff --git a/common/PubnubCore.py b/common/PubnubCore.py
index 5965740..9f79dc8 100644
--- a/common/PubnubCore.py
+++ b/common/PubnubCore.py
@@ -1,23 +1,3 @@
-## www.pubnub.com - PubNub Real-time push service in the cloud.
-# coding=utf8
-
-## PubNub Real-time Push APIs and Notifications Framework
-## Copyright (c) 2010 Stephen Blum
-## http://www.pubnub.com/
-
-## -----------------------------------
-## PubNub 3.3.4 Real-time Push Cloud API
-## -----------------------------------
-
-try: import json
-except ImportError: import simplejson as json
-
-import time
-import hashlib
-import urllib2
-import uuid
-from PubnubBase import PubnubBase
-
class PubnubCore(PubnubBase):
def __init__(
self,
diff --git a/common/PubnubCoreAsync.py b/common/PubnubCoreAsync.py
index 8150bde..e844b96 100644
--- a/common/PubnubCoreAsync.py
+++ b/common/PubnubCoreAsync.py
@@ -1,19 +1,3 @@
-## www.pubnub.com - PubNub Real-time push service in the cloud.
-# coding=utf8
-
-## PubNub Real-time Push APIs and Notifications Framework
-## Copyright (c) 2010 Stephen Blum
-## http://www.pubnub.com/
-
-## -----------------------------------
-## PubNub 3.3.4 Real-time Push Cloud API
-## -----------------------------------
-import sys
-import json
-import time
-import hashlib
-import urllib2
-import uuid
try:
from hashlib import sha256
digestmod = sha256
@@ -21,8 +5,6 @@ except ImportError:
import Crypto.Hash.SHA256 as digestmod
sha256 = digestmod.new
import hmac
-from PubnubCrypto import PubnubCrypto
-from PubnubBase import PubnubBase
class PubnubCoreAsync(PubnubBase):
diff --git a/common/PubnubCrypto.py b/common/PubnubCrypto.py
index b91e2d9..df7cb8d 100644
--- a/common/PubnubCrypto.py
+++ b/common/PubnubCrypto.py
@@ -1,14 +1,3 @@
-## www.pubnub.com - PubNub Real-time push service in the cloud.
-# coding=utf8
-
-## PubNub Real-time Push APIs and Notifications Framework
-## Copyright (c) 2010 Stephen Blum
-## http://www.pubnub.com/
-
-## -----------------------------------
-## PubNub 3.3.4 Real-time Push Cloud API
-## -----------------------------------
-
from Crypto.Cipher import AES
from Crypto.Hash import MD5
from base64 import encodestring, decodestring
@@ -90,4 +79,3 @@ class PubnubCrypto() :
Initial16bytes='0123456789012345'
cipher = AES.new(secret[0:32],AES.MODE_CBC,Initial16bytes)
return self.depad((cipher.decrypt(decodestring(msg))))
-
diff --git a/common/PubnubUnitTest.py b/common/PubnubUnitTest.py
new file mode 100644
index 0000000..2f9d28c
--- /dev/null
+++ b/common/PubnubUnitTest.py
@@ -0,0 +1,36 @@
+
+import time
+
+class Suite():
+ def __init__(self, pubnub, expected):
+ self.pubnub = pubnub
+ self.total = expected
+ self.passed = 0
+ self.failed = 0
+ self.started = False
+
+ def test(self, condition , name, message = None, response = None):
+
+ if condition:
+ self.passed += 1
+ msg = "PASS : " + name
+ if message:
+ msg += ", " + message
+ if response:
+ msg += ", " + response
+ print msg
+ else:
+ self.failed += 1
+ msg = "FAIL : " + name
+ if message:
+ msg += ", " + message
+ if response:
+ msg += ", " + response
+ print msg
+
+ if self.total == self.failed + self.passed:
+ print "\n======== RESULT ========"
+ print "Total\t:\t", self.total
+ print "Passed\t:\t", self.passed
+ print "Failed\t:\t", self.failed
+ self.pubnub.stop()