|
a/Allura/allura/tests/test_helpers.py |
|
b/Allura/allura/tests/test_helpers.py |
|
... |
|
... |
98 |
h.urlquote(u'\u0410')
|
98 |
h.urlquote(u'\u0410')
|
99 |
h.urlquoteplus(u'\u0410')
|
99 |
h.urlquoteplus(u'\u0410')
|
100 |
|
100 |
|
101 |
def test_sharded_path():
|
101 |
def test_sharded_path():
|
102 |
assert_equals(h.sharded_path('foobar'), 'f/fo')
|
102 |
assert_equals(h.sharded_path('foobar'), 'f/fo')
|
|
|
103 |
|
|
|
104 |
def test_paging_sanitizer():
|
|
|
105 |
test_data = {
|
|
|
106 |
# input (limit, page, total, zero-based): output (limit, page)
|
|
|
107 |
(0, 0, 0): (1, 0),
|
|
|
108 |
('1', '1', 1): (1, 0),
|
|
|
109 |
(5, '10', 25): (5, 4),
|
|
|
110 |
('5', 10, 25, False): (5, 5),
|
|
|
111 |
(5, '-1', 25): (5, 0),
|
|
|
112 |
('5', -1, 25, False): (5, 1),
|
|
|
113 |
(5, '3', 25): (5, 3),
|
|
|
114 |
('5', 3, 25, False): (5, 3)
|
|
|
115 |
}
|
|
|
116 |
for input, output in test_data.iteritems():
|
|
|
117 |
assert (h.paging_sanitizer(*input)) == output
|