# Path: restkit/filters.py
# class BasicAuth(object):
#     """ Simple filter to manage basic authentification"""
#     
#     def __init__(self, username, password):
#         self.credentials = (username, password)
#     
#     def on_request(self, request):
#         encode = base64.b64encode("%s:%s" % self.credentials)
#         request.headers['Authorization'] = 'Basic %s' %  encode


import cgi
import imghdr
import os
import socket
import threading
import Queue
import urlparse
import sys
import tempfile
import time
import t
from restkit.filters import BasicAuth
This is a relatively long body, that we send to the client...
This is a relatively long body, that we send to the client...
This is a relatively long body, that we send to the client...
This is a relatively long body, that we send to the client...
This is a relatively long body, that we send to the client...
This is a relatively long body, that we send to the client...
This is a relatively long body, that we send to the client...
This is a relatively long body, that we send to the client...
This is a relatively long body, that we send to the client...
This is a relatively long body, that we send to the client...
This is a relatively long body, that we send to the client...
This is a relatively long body, that we send to the client...
This is a relatively long body, that we send to the client...
This is a relatively long body, that we send to the client...
This is a relatively long body, that we send to the client...
This is a relatively long body, that we send to the client...
This is a relatively long body, that we send to the client...
This is a relatively long body, that we send to the client...
This is a relatively long body, that we send to the client...
This is a relatively long body, that we send to the client...
This is a relatively long body, that we send to the client..."""

@t.client_request("/")
def test_001(u, c):
    r = c.request(u)
    t.eq(r.body_string(), "welcome")
    
@t.client_request("/unicode")
def test_002(u, c):
    r = c.request(u)

# Path: restkit/filters.py
# class BasicAuth(object):
#     """ Simple filter to manage basic authentification"""
#     
#     def __init__(self, username, password):
#         self.credentials = (username, password)
#     
#     def on_request(self, request):
#         encode = base64.b64encode("%s:%s" % self.credentials)
#         request.headers['Authorization'] = 'Basic %s' %  encode


# Path: tests/004-test-client.py
import cgi
import imghdr
import os
import socket
import threading
import Queue
import urlparse
import sys
import tempfile
import time
import t
from restkit.filters import BasicAuth

This is a relatively long body, that we send to the client...
This is a relatively long body, that we send to the client...
This is a relatively long body, that we send to the client...
This is a relatively long body, that we send to the client...
This is a relatively long body, that we send to the client...
This is a relatively long body, that we send to the client...
This is a relatively long body, that we send to the client...
This is a relatively long body, that we send to the client...
This is a relatively long body, that we send to the client...
This is a relatively long body, that we send to the client...
This is a relatively long body, that we send to the client...
This is a relatively long body, that we send to the client...
This is a relatively long body, that we send to the client...
This is a relatively long body, that we send to the client...
This is a relatively long body, that we send to the client...
This is a relatively long body, that we send to the client...
This is a relatively long body, that we send to the client...
This is a relatively long body, that we send to the client...
This is a relatively long body, that we send to the client...
This is a relatively long body, that we send to the client...
This is a relatively long body, that we send to the client..."""

@t.client_request("/")
def test_001(u, c):
    r = c.request(u)
    t.eq(r.body_string(), "welcome")
    
@t.client_request("/unicode")
def test_002(u, c):
    r = c.request(u)

    t.eq(r.body_string(charset="utf-8"), u"éàù@")