# Path: wsse/settings.py
# TIMESTAMP_DURATION = 2 * 60 * 60
# DRIFT_OFFSET = 2 * 60
# TIMESTAMP_FORMATS = [
# 	'%Y-%m-%dT%H:%M:%SZ',    # ISO 8601 in UTC (Z specifies 0 offset)
# 	'%Y-%m-%dT%H:%M:%S',     # ISO 8601 without timezone - assumed to be UTC
# 	'%Y-%m-%dT%H:%M:%S.%fZ', # ISO 8601 with microseconds in UTC
# 	'%Y-%m-%dT%H:%M:%S.%f',  # ISO 8601 with microseconds (assumed UTC)
# 	'%Y-%m-%dT%H:%M:%S%z',   # ISO 8601 with UTC offset
# 	'%Y-%m-%dT%H:%M:%S.%f%z' # ISO 8601 with microseconds and UTC offset
# 	]
# NONCE_LENGTH = 64
# NONCE_STORE = 'wsse.server.default.store.SQLiteNonceStore'
# NONCE_STORE_ARGS = (':memory:',)
# REQUEST_HEADER = 'X-WSSE'
# SECURITY_CHECK_NONCE = True
# SECURITY_CHECK_TIMESTAMP = True
# ALLOWED_DIGEST_ALGORITHMS = ['SHA256']
# PROHIBITED_DIGEST_ALGORITHMS = ['SHA1', 'MD5']
# SECRET_KEY_LENGTH = 64
# LOGGER_NAME = 'wsse'
# 
# Path: wsse/utc.py
# class _UTC(datetime.tzinfo):
#   def utcoffset(self, dt):
#   def tzname(self, dt):
#   def dst(self, dt):
# 
# Path: wsse/server/default/store.py
# class SQLiteNonceStore(object):
# 	def __init__(self, connection_url, table = 'nonce_store'):
# 	def open(self):
# 	def close(self):
# 	def __transaction(self):
# 	def __setup(self):
# 	def _clear(self):
# 	def add_nonce(self, nonce, timestamp = None):
# 	def has_nonce(self, nonce):
# 	def clean_expired_nonces(self):


from unittest import TestCase
from wsse import settings, utc
from wsse.server.default import store
import datetime

	def test_add_nonce(self):
		'''
		Once a nonce is added to the store, it should be present in the database.
		'''
		self.store.add_nonce('abc')

		count = self.count_nonces()
		nonce = self.get_nonces()[0]
		
		self.assertEqual(count, 1)
		self.assertEqual(nonce, 'abc')

	def test_add_nonce_multiple(self):
		'''
		Add multiple nonces into the store. Both should be present.
		'''
		self.store.add_nonce('abc')
		self.store.add_nonce('def')

		count = self.count_nonces()
		nonce_values = self.get_nonces()
		
		self.assertEqual(count, 2)
		self.assertEqual(nonce_values, ['abc', 'def'])

	def test_has_nonce(self):
		'''
		Add a nonce to the database. Checking if it's there should be successful.
		'''

# Path: wsse/settings.py
# TIMESTAMP_DURATION = 2 * 60 * 60
# DRIFT_OFFSET = 2 * 60
# TIMESTAMP_FORMATS = [
# 	'%Y-%m-%dT%H:%M:%SZ',    # ISO 8601 in UTC (Z specifies 0 offset)
# 	'%Y-%m-%dT%H:%M:%S',     # ISO 8601 without timezone - assumed to be UTC
# 	'%Y-%m-%dT%H:%M:%S.%fZ', # ISO 8601 with microseconds in UTC
# 	'%Y-%m-%dT%H:%M:%S.%f',  # ISO 8601 with microseconds (assumed UTC)
# 	'%Y-%m-%dT%H:%M:%S%z',   # ISO 8601 with UTC offset
# 	'%Y-%m-%dT%H:%M:%S.%f%z' # ISO 8601 with microseconds and UTC offset
# 	]
# NONCE_LENGTH = 64
# NONCE_STORE = 'wsse.server.default.store.SQLiteNonceStore'
# NONCE_STORE_ARGS = (':memory:',)
# REQUEST_HEADER = 'X-WSSE'
# SECURITY_CHECK_NONCE = True
# SECURITY_CHECK_TIMESTAMP = True
# ALLOWED_DIGEST_ALGORITHMS = ['SHA256']
# PROHIBITED_DIGEST_ALGORITHMS = ['SHA1', 'MD5']
# SECRET_KEY_LENGTH = 64
# LOGGER_NAME = 'wsse'
# 
# Path: wsse/utc.py
# class _UTC(datetime.tzinfo):
#   def utcoffset(self, dt):
#   def tzname(self, dt):
#   def dst(self, dt):
# 
# Path: wsse/server/default/store.py
# class SQLiteNonceStore(object):
# 	def __init__(self, connection_url, table = 'nonce_store'):
# 	def open(self):
# 	def close(self):
# 	def __transaction(self):
# 	def __setup(self):
# 	def _clear(self):
# 	def add_nonce(self, nonce, timestamp = None):
# 	def has_nonce(self, nonce):
# 	def clean_expired_nonces(self):


# Path: wsse/server/default/tests/test_store.py
from unittest import TestCase
from wsse import settings, utc
from wsse.server.default import store
import datetime


	def test_add_nonce(self):
		'''
		Once a nonce is added to the store, it should be present in the database.
		'''
		self.store.add_nonce('abc')

		count = self.count_nonces()
		nonce = self.get_nonces()[0]
		
		self.assertEqual(count, 1)
		self.assertEqual(nonce, 'abc')

	def test_add_nonce_multiple(self):
		'''
		Add multiple nonces into the store. Both should be present.
		'''
		self.store.add_nonce('abc')
		self.store.add_nonce('def')

		count = self.count_nonces()
		nonce_values = self.get_nonces()
		
		self.assertEqual(count, 2)
		self.assertEqual(nonce_values, ['abc', 'def'])

	def test_has_nonce(self):
		'''
		Add a nonce to the database. Checking if it's there should be successful.
		'''

		now = datetime.datetime.utcnow().replace(tzinfo=utc.utc).replace(tzinfo=utc.utc)