~ubuntu-branches/ubuntu/quantal/python-cloudfiles/quantal

« back to all changes in this revision

Viewing changes to tests/utils_test.py

  • Committer: Bazaar Package Importer
  • Author(s): Chuck Short
  • Date: 2011-08-04 13:07:55 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20110804130755-rmid2ihh2444a91u
Tags: 1.7.9.2-0ubuntu1
Initial release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
 
2
2
import unittest
3
3
from misc             import printdoc
4
 
from cloudfiles.utils  import parse_url
 
4
from cloudfiles.utils  import unicode_quote, parse_url
5
5
 
6
6
@printdoc
7
7
def test_parse_url():
8
8
    """
9
 
    Validate that the parse_url() function properly returns the hostname, 
10
 
    port number, path (if any), and ssl boolean. Attempts several 
 
9
    Validate that the parse_url() function properly returns the hostname,
 
10
    port number, path (if any), and ssl boolean. Attempts several
11
11
    different URL permutations, (5 tests total).
12
12
    """
13
13
    urls = {
57
57
    assert path == urlspec['path'], "%s failed on path assertion" % test
58
58
    assert ssl == urlspec['ssl'], "%s failed on ssl assertion" % test
59
59
 
 
60
def test_unicode_quote():
 
61
    """
 
62
    Ensure that unicode strings are encoded as utf-8 properly for use with the
 
63
    quote method of the urlparse stdlib.
 
64
    """
 
65
    assert unicode_quote("non-unicode text") == "non-unicode%20text"
 
66
    assert unicode_quote(u'\xe1gua.txt') == "%C3%A1gua.txt"
 
67
 
60
68
# vim:set ai sw=4 ts=4 tw=0 expandtab: