Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
nigelb
committed
Jun 25, 2014
1 parent
19c6920
commit 671e05d
Showing
1 changed file
with
32 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# -*- coding: utf-8 -*- | ||
'''Unit tests for ckan/logic/converters.py. | ||
''' | ||
import unittest | ||
import ckan.logic.converters as converters | ||
|
||
|
||
class TestRemoveWhitespaceConverter(unittest.TestCase): | ||
def test_leading_space(self): | ||
string = ' http://example.com' | ||
expected = 'http://example.com' | ||
converted = converters.remove_whitespace(string, {}) | ||
self.assertEqual(expected, converted) | ||
|
||
def test_trailing_space(self): | ||
string = 'http://example.com ' | ||
expected = 'http://example.com' | ||
converted = converters.remove_whitespace(string, {}) | ||
self.assertEqual(expected, converted) | ||
|
||
def test_space_between(self): | ||
string = 'http://example.com/space between url ' | ||
expected = 'http://example.com/space between url' | ||
converted = converters.remove_whitespace(string, {}) | ||
self.assertEqual(expected, converted) | ||
|
||
def test_not_a_string(self): | ||
string = 12345 | ||
expected = 12345 | ||
converted = converters.remove_whitespace(string, {}) | ||
self.assertEqual(string, converted) |