Commit c6000520 by Michael Frey Committed by Michael Frey

Add test

parent 5e38805e
# -*- coding: utf-8 -*-
import json import json
import time import time
from urllib import urlencode from urllib import urlencode
...@@ -65,8 +66,8 @@ class SDNCheckTests(TestCase): ...@@ -65,8 +66,8 @@ class SDNCheckTests(TestCase):
'sources': self.site_configuration.sdn_api_list, 'sources': self.site_configuration.sdn_api_list,
'api_key': self.site_configuration.sdn_api_key, 'api_key': self.site_configuration.sdn_api_key,
'type': 'individual', 'type': 'individual',
'name': self.name, 'name': unicode(self.name).encode('utf-8'),
'address': self.address, 'address': unicode(self.address).encode('utf-8'),
'countries': self.country 'countries': self.country
}) })
sdn_check_url = '{api_url}?{params}'.format( sdn_check_url = '{api_url}?{params}'.format(
...@@ -113,6 +114,15 @@ class SDNCheckTests(TestCase): ...@@ -113,6 +114,15 @@ class SDNCheckTests(TestCase):
response = self.sdn_validator.search(self.name, self.address, self.country) response = self.sdn_validator.search(self.name, self.address, self.country)
self.assertEqual(response, sdn_response) self.assertEqual(response, sdn_response)
@httpretty.activate
def test_sdn_check_unicode_match(self):
""" Verify the SDN check returns the number of matches and records the match. """
sdn_response = {'total': 1}
self.name = u'Keyser Söze'
self.mock_sdn_response(json.dumps(sdn_response))
response = self.sdn_validator.search(self.name, self.address, self.country)
self.assertEqual(response, sdn_response)
def test_deactivate_user(self): def test_deactivate_user(self):
""" Verify an SDN failure is logged. """ """ Verify an SDN failure is logged. """
response = {'description': 'Bad dude.'} response = {'description': 'Bad dude.'}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment