Changeset - f6ac79182600
[Not reviewed]
default
0 6 4
Marcin Kuzminski - 16 years ago 2010-04-07 20:19:25
marcin@python-blog.com
Added rest controllers for repos and users,
templating changes + css fixes
10 files changed with 239 insertions and 44 deletions:
0 comments (0 inline, 0 general)
pylons_app/config/routing.py
Show inline comments
 
"""Routes configuration
 

	
 
The more specific and detailed routes should be defined first so they
 
may take precedent over the more generic routes. For more information
 
refer to the routes manual at http://routes.groovie.org/docs/
 
"""
 
from routes import Mapper
 

	
 
def make_map(config):
 
    """Create, configure and return the routes Mapper"""
 
    map = Mapper(directory=config['pylons.paths']['controllers'],
 
                 always_scan=config['debug'])
 
    map.minimization = False
 
    map.explicit = False
 

	
 
    # The ErrorController route (handles 404/500 error pages); it should
 
    # likely stay at the top, ensuring it can always be resolved
 
    map.connect('/error/{action}', controller='error')
 
    map.connect('/error/{action}/{id}', controller='error')
 

	
 
    # CUSTOM ROUTES HERE
 
    with map.submapper(path_prefix='/_admin', controller='admin') as m:
 
        m.connect('admin_home', '/', action='index')#main page
 
        m.connect('admin_add_repo', '/add_repo/{new_repo:[a-z0-9\. _-]*}', action='add_repo')
 
        m.connect('admin_users_manage', '/repos_manage', action='users_manage')
 
        m.connect('admin_repos_manage', '/users_manage', action='repos_manage')
 
    
 
    map.resource('repo', 'repos', path_prefix='/_admin')
 
    map.resource('user', 'users', path_prefix='/_admin')
 
        
 
    map.connect('hg', '/{path_info:.*}', controller='hg',
 
                action="view", path_info='/')
 

	
 
    return map
pylons_app/controllers/admin.py
Show inline comments
 
import logging
 

	
 
from pylons import request, response, session, tmpl_context as c, url, app_globals as g
 
from pylons.controllers.util import abort, redirect
 

	
 
from pylons_app.lib.base import BaseController, render
 
import os
 
from mercurial import ui, hg
 
from mercurial.error import RepoError
 
from ConfigParser import ConfigParser
 
from pylons_app.lib import auth
 
from pylons_app.model.forms import LoginForm
 
import formencode
 
import formencode.htmlfill as htmlfill
 
log = logging.getLogger(__name__)
 

	
 
class AdminController(BaseController):
 

	
 

	
 
    def __before__(self):
 
        c.staticurl = g.statics
 
        c.admin_user = session.get('admin_user')
 
        c.admin_username = session.get('admin_username')
 
        
 
    def index(self):
 
        # Return a rendered template
 
        if request.POST:
 
            #import Login Form validator class
 
            login_form = LoginForm()
 

	
 
            try:
 
                c.form_result = login_form.to_python(dict(request.params))
 
                if auth.admin_auth(c.form_result['username'], c.form_result['password']):
 
                    session['admin_user'] = True
 
                    session['admin_username'] = c.form_result['username']
 
                    session.save()
 
                    return redirect(url('admin_home'))
 
                else:
 
                    raise formencode.Invalid('Login Error', None, None,
 
                                             error_dict={'username':'invalid login',
 
                                                         'password':'invalid password'})
 
                                      
 
            except formencode.Invalid, error:
 
                c.form_result = error.value
 
                c.form_errors = error.error_dict or {}
 
                html = render('/admin.html')
 

	
 
                return htmlfill.render(
 
                    html,
 
                    defaults=c.form_result,
 
                    encoding="UTF-8"
 
                )
 
        return render('/admin.html')
 

	
 
    def repos_manage(self):
 
        return render('/repos_manage.html')
 
    
 
    def users_manage(self):
 
        conn, cur = auth.get_sqlite_conn_cur()
 
        cur.execute('SELECT * FROM users')
 
        c.users_list = cur.fetchall()        
 
        return render('/users_manage.html')
 
                
 
    def manage_hgrc(self):
 
        pass
 

	
 
    def hgrc(self, dirname):
 
        filename = os.path.join(dirname, '.hg', 'hgrc')
 
        return filename
 

	
 
    def add_repo(self, new_repo):
 
        
 

	
 
        #extra check it can be add since it's the command
 
        if new_repo == '_admin':
 
            c.msg = 'DENIED'
 
            c.new_repo = ''
 
            return render('add.html')
 

	
 
        new_repo = new_repo.replace(" ", "_")
 
        new_repo = new_repo.replace("-", "_")
 

	
 
        try:
 
            self._create_repo(new_repo)
 
            c.new_repo = new_repo
 
            c.msg = 'added repo'
 
        except Exception as e:
 
            c.new_repo = 'Exception when adding: %s' % new_repo
 
            c.msg = str(e)
 

	
 
        return render('add.html')
 

	
 
    def _check_repo(self, repo_name):
 
        p = os.path.dirname(os.path.dirname(os.path.dirname(__file__)))
 
        config_path = os.path.join(p, 'hgwebdir.config')
 

	
 
        cp = ConfigParser()
 

	
 
        cp.read(config_path)
 
        repos_path = cp.get('paths', '/').replace("**", '')
 

	
 
        if not repos_path:
 
            raise Exception('Could not read config !')
 

	
 
        self.repo_path = os.path.join(repos_path, repo_name)
 

	
 
        try:
 
            r = hg.repository(ui.ui(), self.repo_path)
 
            hg.verify(r)
 
            #here we hnow that repo exists it was verified
 
            log.info('%s repo is already created', repo_name)
 
            raise Exception('Repo exists')
 
        except RepoError:
 
            log.info('%s repo is free for creation', repo_name)
 
            #it means that there is no valid repo there...
 
            return True
 

	
 

	
 
    def _create_repo(self, repo_name):
 
        if repo_name in [None, '', 'add']:
 
            raise Exception('undefined repo_name of repo')
 

	
 
        if self._check_repo(repo_name):
 
            log.info('creating repo %s in %s', repo_name, self.repo_path)
 
            cmd = """mkdir %s && hg init %s""" \
 
                    % (self.repo_path, self.repo_path)
 
            os.popen(cmd)
pylons_app/controllers/repos.py
Show inline comments
 
new file 100644
 
import logging
 

	
 
from pylons import request, response, session, tmpl_context as c, url, app_globals as g
 
from pylons.controllers.util import abort, redirect
 
from pylons_app.lib import auth
 
from pylons_app.lib.base import BaseController, render
 

	
 
log = logging.getLogger(__name__)
 

	
 
class ReposController(BaseController):
 
    """REST Controller styled on the Atom Publishing Protocol"""
 
    # To properly map this controller, ensure your config/routing.py
 
    # file has a resource setup:
 
    #     map.resource('repo', 'repos')
 
    def __before__(self):
 
        c.staticurl = g.statics
 
        c.admin_user = session.get('admin_user')
 
        c.admin_username = session.get('admin_username')
 
        
 
    def index(self, format='html'):
 
        """GET /repos: All items in the collection"""
 
        # url('repos')
 
        return render('/repos_manage.html')
 
    
 
    def create(self):
 
        """POST /repos: Create a new item"""
 
        # url('repos')
 

	
 
    def new(self, format='html'):
 
        """GET /repos/new: Form to create a new item"""
 
        # url('new_repo')
 

	
 
    def update(self, id):
 
        """PUT /repos/id: Update an existing item"""
 
        # Forms posted to this method should contain a hidden field:
 
        #    <input type="hidden" name="_method" value="PUT" />
 
        # Or using helpers:
 
        #    h.form(url('repo', id=ID),
 
        #           method='put')
 
        # url('repo', id=ID)
 

	
 
    def delete(self, id):
 
        """DELETE /repos/id: Delete an existing item"""
 
        # Forms posted to this method should contain a hidden field:
 
        #    <input type="hidden" name="_method" value="DELETE" />
 
        # Or using helpers:
 
        #    h.form(url('repo', id=ID),
 
        #           method='delete')
 
        # url('repo', id=ID)
 

	
 
    def show(self, id, format='html'):
 
        """GET /repos/id: Show a specific item"""
 
        # url('repo', id=ID)
 

	
 
    def edit(self, id, format='html'):
 
        """GET /repos/id/edit: Form to edit an existing item"""
 
        # url('edit_repo', id=ID)
pylons_app/controllers/users.py
Show inline comments
 
new file 100644
 
import logging
 

	
 
from pylons import request, response, session, tmpl_context as c, url, app_globals as g
 
from pylons.controllers.util import abort, redirect
 

	
 
from pylons_app.lib.base import BaseController, render
 
from pylons_app.lib import auth
 
log = logging.getLogger(__name__)
 

	
 
class UsersController(BaseController):
 
    """REST Controller styled on the Atom Publishing Protocol"""
 
    # To properly map this controller, ensure your config/routing.py
 
    # file has a resource setup:
 
    #     map.resource('user', 'users')
 
    def __before__(self):
 
        c.staticurl = g.statics
 
        c.admin_user = session.get('admin_user')
 
        c.admin_username = session.get('admin_username')
 
        
 
    def index(self, format='html'):
 
        """GET /users: All items in the collection"""
 
        # url('users')
 
        conn, cur = auth.get_sqlite_conn_cur()
 
        cur.execute('SELECT * FROM users')
 
        c.users_list = cur.fetchall()        
 
        return render('/users_manage.html')
 
    
 
    def create(self):
 
        """POST /users: Create a new item"""
 
        # url('users')
 

	
 
    def new(self, format='html'):
 
        """GET /users/new: Form to create a new item"""
 
        # url('new_user')
 

	
 
    def update(self, id):
 
        """PUT /users/id: Update an existing item"""
 
        # Forms posted to this method should contain a hidden field:
 
        #    <input type="hidden" name="_method" value="PUT" />
 
        # Or using helpers:
 
        #    h.form(url('user', id=ID),
 
        #           method='put')
 
        # url('user', id=ID)
 

	
 
    def delete(self, id):
 
        """DELETE /users/id: Delete an existing item"""
 
        # Forms posted to this method should contain a hidden field:
 
        #    <input type="hidden" name="_method" value="DELETE" />
 
        # Or using helpers:
 
        #    h.form(url('user', id=ID),
 
        #           method='delete')
 
        # url('user', id=ID)
 

	
 
    def show(self, id, format='html'):
 
        """GET /users/id: Show a specific item"""
 
        # url('user', id=ID)
 

	
 
    def edit(self, id, format='html'):
 
        """GET /users/id/edit: Form to edit an existing item"""
 
        # url('edit_user', id=ID)
pylons_app/public/hg_static/style-monoblue.css
Show inline comments
 
@@ -53,193 +53,195 @@ div.page-header {
 
  }
 
  div.rss_logo { 
 
    float: right; white-space: nowrap; 
 
  }
 
  div.rss_logo a {
 
    padding:3px 6px; line-height:10px;
 
    border:1px solid; border-color:#fcc7a5 #7d3302 #3e1a01 #ff954e;
 
    color:#ffffff; background-color:#ff6600;
 
    font-weight:bold; font-family:sans-serif; font-size:10px;
 
    text-align:center; text-decoration:none;
 
}
 
  div.rss_logo a:hover { 
 
    background-color:#ee5500; 
 
  }
 

	
 
  td.indexlinks { 
 
	   white-space: nowrap; 
 
  }
 
  td.indexlinks a {
 
	  padding: 2px 5px; line-height: 10px;
 
	  border: 1px solid;
 
	  color: #ffffff; background-color: #7777bb;
 
	  border-color: #aaaadd #333366 #333366 #aaaadd;
 
	  font-weight: bold;  text-align: center; text-decoration: none;
 
	  font-size: 10px;
 
  }
 
  td.indexlinks a:hover {
 
	 background-color: #6666aa; 
 
  }
 

	
 
  div.page-header form {
 
    position: absolute;
 
    margin-bottom: 2px;
 
    bottom: 0;
 
    right: 20px;
 
  }
 
  div.page-header form label {
 
    color: #DDD;
 
  }
 
  div.page-header form input {
 
    padding: 2px;
 
    border: solid 1px #DDD;
 
  }
 
  div.page-header form dl {
 
    overflow: hidden;
 
  }
 
  div.page-header form dl dt {
 
    font-size: 1.2em;
 
  }
 
  div.page-header form dl dt,
 
  div.page-header form dl dd {
 
    margin: 0 0 0 5px;
 
    float: left;
 
    height: 24px;
 
    line-height: 20px;
 
  }
 

	
 
  ul.page-nav {
 
    margin: 10px 0 0 0;
 
    list-style-type: none;
 
    overflow: hidden;
 
    width: 800px;
 
  }
 
    ul.page-nav li {
 
      margin: 0 2px 0 0;
 
      float: left;
 
      width: 80px;
 
      height: 24px;
 
      font-size: 1.1em;
 
      line-height: 24px;
 
      text-align: center;
 
    }
 
    ul.page-nav li.current {
 
      background: #FFF;
 
    }
 
    ul.page-nav li a {
 
      height: 24px;
 
      color: #666;
 
      background: #DDD;
 
      display: block;
 
      text-decoration: none;
 
    }
 
    ul.page-nav li a:hover {
 
      color:#333;
 
      background: #FFF;
 
    }
 

	
 
ul.submenu {
 
  margin: 10px 0 -10px 20px;
 
  list-style-type: none;
 
}
 
ul.submenu li {
 
  margin: 0 10px 0 0;
 
  font-size: 1.2em;
 
  display: inline;
 
}
 

	
 
ul.submenu li.current_submenu {
 
	border-bottom: 2px solid #006699;
 
}
 
h2 {
 
  margin: 20px 0 10px;
 
  height: 30px;
 
  line-height: 30px;
 
  text-indent: 20px;
 
  background: #FFF;
 
  font-size: 1.2em;
 
  border-top: dotted 1px #D5E1E6;
 
  font-weight: bold;
 
}
 
h2.no-link {
 
  color:#006699;
 
}
 
h2.no-border {
 
  color: #FFF;
 
  background: #006699;
 
  border: 0;
 
}
 
h2 a {
 
  font-weight:bold;
 
  color:#006699;
 
}
 

	
 
div.page-path {
 
  text-align: right;
 
  padding: 20px 30px 10px 0;
 
  border:solid #d9d8d1;
 
  border-width:0px 0px 1px;
 
  font-size: 1.2em;
 
}
 

	
 
div.page-footer {
 
  margin: 50px 0 0;
 
  position: relative;
 
}
 
  div.page-footer p {
 
    position: relative;
 
    left: 20px;
 
    bottom: 5px;
 
    font-size: 1.2em;
 
  }
 

	
 
  ul.rss-logo {
 
    position: absolute;
 
    top: -10px;
 
    right: 20px;
 
    height: 20px;
 
    list-style-type: none;
 
  }
 
  ul.rss-logo li {
 
    display: inline;
 
  }
 
  ul.rss-logo li a {
 
    padding: 3px 6px;
 
    line-height: 10px;
 
    border:1px solid;
 
    border-color:#fcc7a5 #7d3302 #3e1a01 #ff954e;
 
    color:#ffffff;
 
    background-color:#ff6600;
 
    font-weight:bold;
 
    font-family:sans-serif;
 
    font-size:10px;
 
    text-align:center;
 
    text-decoration:none;
 
  }
 
  div.rss-logo li a:hover {
 
    background-color:#ee5500;
 
  }
 

	
 
p.normal {
 
  margin: 20px 0 20px 30px;
 
  font-size: 1.2em;
 
}
 

	
 
table {
 
  margin: 10px 0 0 20px;
 
  width: auto;
 
  border-collapse: collapse;
 
}
 
table tr td {
 
  font-size: 1.1em;
 
}
 
table tr td.nowrap {
 
  white-space: nowrap;
 
}
 
/*
 
table tr.parity0:hover,
 
table tr.parity1:hover {
 
  background: #D5E1E6;
 
}
 
*/
 
table tr.parity0 {
 
  background: #F1F6F7;
 
}
 
table tr.parity1 {
 
  background: #FFFFFF;
pylons_app/templates/admin.html
Show inline comments
 
## -*- coding: utf-8 -*-
 
<%inherit file="base/base.html"/>
 
 <%def name="get_form_error(element)">
 
    %if type(c.form_errors) == dict:
 
        %if c.form_errors.get(element,False):
 
            <span class="error-message">
 
                ${c.form_errors.get(element,'')}
 
            </span>
 
        %endif
 
    %endif           
 
 </%def>
 
<%def name="title()">
 
    ${_('Repository managment')}
 
</%def>
 
<%def name="breadcrumbs()">
 
	${h.link_to(u'Home',h.url('/'))}
 
	 / 
 
	${h.link_to(u'Admin',h.url('admin_home'))}
 
</%def>
 
<%def name="page_nav()">
 
<li>${h.link_to(u'Home',h.url('/'))}</li>
 
<li class="current">${_('Admin')}</li>
 
</%def>
 
<%def name="main()">
 
    %if c.admin_user:
 
    <ul class="submenu">
 
        <li>
 
            ${h.link_to(u'Repos managment',h.url('admin_repos_manage'))}
 
            ${h.link_to(u'Repos',h.url('repos'))}
 
        </li>
 
        <li>
 
            ${h.link_to(u'Users managment',h.url('admin_users_manage'))}
 
            ${h.link_to(u'Users',h.url('users'))}
 
        </li>
 
    </ul>
 
    <br/>
 
    <div>
 
    
 
        <h2>Hi !</h2>
 
    </div>
 
    %else:
 
        <div>
 
        <br />
 
        <h2>${_('Login')}</h2>
 
        ${h.form(h.url.current())}
 
        <table>
 
            <tr>
 
                <td>${_('Username')}</td>
 
                <td>${h.text('username')}</td>
 
                <td>${get_form_error('username')} </td>
 
            </tr>
 
            <tr>
 
                <td>${_('Password')}</td>
 
                <td>${h.password('password')}</td>
 
                <td>${get_form_error('password')}</td> 
 
            </tr>
 
            <tr>
 
                <td></td>
 
                <td>${h.submit('login','login')}</td>
 
            </tr>            
 
        </table>
 
        ${h.end_form()}
 
        </div>
 
    %endif
 
    
 
</%def>
 
\ No newline at end of file
pylons_app/templates/repos_manage.html
Show inline comments
 
<%inherit file="base/base.html"/>
 
<%def name="title()">
 
    ${_('Repository managment')}
 
</%def>
 
<%def name="breadcrumbs()">
 
    ${h.link_to(u'Home',h.url('/'))}
 
    / 
 
    ${h.link_to(u'Admin',h.url('admin_home'))}
 
    /
 
    ${h.link_to(u'Repos managment',h.url('admin_repos_manage'))}
 
    ${h.link_to(u'Repos managment',h.url('repos'))}
 
</%def>
 
<%def name="page_nav()">
 
	<li>${h.link_to(u'Home',h.url('/'))}</li>
 
	<li class="current">${_('Admin')}</li>
 
</%def>
 
<%def name="main()">
 

	
 

	
 
<div class="twocol-form">
 
        <h2>Create new repository</h2>
 
        <form method="post" action="/repo/create/">
 
            <table>
 
                <tbody><tr><th><label for="id_name">Name:</label></th><td><input type="text" maxlength="255" name="name" id="id_name"></td></tr>
 
<tr><th><label for="id_description">Description:</label></th><td><textarea name="description" cols="40" rows="10" id="id_description"></textarea></td></tr>
 
<tr><th><label for="id_website">Website:</label></th><td><input type="text" maxlength="128" name="website" id="id_website"></td></tr>
 
<tr><th><label for="id_is_private">Private:</label></th><td><input type="checkbox" id="id_is_private" name="is_private"></td></tr>
 
<tr><th><label for="id_has_issues">Issue tracking:</label></th><td><input type="checkbox" id="id_has_issues" name="has_issues" checked="checked"></td></tr>
 
<tr><th><label for="id_has_wiki">Wiki:</label></th><td><input type="checkbox" id="id_has_wiki" name="has_wiki" checked="checked"></td></tr>
 
                
 
                
 
                <tr><td colspan="2">&nbsp;</td></tr>
 
                <tr>
 
                    <td colspan="2">
 
                        <input type="submit" class="primary-button" value="Create repository"> <input type="reset" onclick="document.location='http://bitbucket.org/';" class="secondary-button secondary-button-darkbg" value="Cancel">
 
                    </td>
 
                </tr>
 
            </tbody></table>
 
        </form>
 
    <ul class="submenu">
 
        <li class="current_submenu">
 
            ${h.link_to(u'Repos',h.url('repos'))}
 
        </li>
 
        <li>
 
            ${h.link_to(u'Users',h.url('users'))}
 
        </li>
 
    </ul>
 
	<div>
 
        <h2>${_('Mercurial repos')}</h2>
 
    </div>
 
</%def>    
 
\ No newline at end of file
pylons_app/templates/users_manage.html
Show inline comments
 
<%inherit file="base/base.html"/>
 
<%def name="title()">
 
    ${_('Repository managment')}
 
</%def>
 
<%def name="breadcrumbs()">
 
    ${h.link_to(u'Home',h.url('/'))}
 
    / 
 
    ${h.link_to(u'Admin',h.url('admin_home'))}
 
    /
 
    ${h.link_to(u'Users managment',h.url('admin_users_manage'))}
 
    ${h.link_to(u'Users managment',h.url('users'))}
 
</%def>
 
<%def name="page_nav()">
 
    <li>${h.link_to(u'Home',h.url('/'))}</li>
 
    <li class="current">${_('Admin')}</li>
 
</%def>
 
<%def name="main()">
 

	
 
    <ul class="submenu">
 
        <li>
 
            ${h.link_to(u'Repos',h.url('repos'))}
 
        </li>
 
        <li class="current_submenu">
 
            ${h.link_to(u'Users',h.url('users'))}
 
        </li>
 
    </ul>
 
	<div>
 
        <h2>${_('Mercurial users')}</h2>
 
        <table cellspacing="0">
 
         <tr>
 
            <th>Id</th>
 
            <th>Username</th>
 
            <th>Password</th>
 
            <th>Active</th>
 
         </tr>    
 
            <th>Admin</th>
 
         </tr>
 
            %for i in c.users_list:
 
                <tr>
 
                    <td>${i[0]}</td>
 
                    <td>${i[1]}</td>
 
                    <td>${i[2]}</td>
 
                    <td>${i[3]}</td>
 
                    <td>${i[4]}</td>
 
                </tr>
 
            %endfor
 
        </table>
 
        </table>        
 
    </div>
 

	
 
</%def>    
 
\ No newline at end of file
pylons_app/tests/functional/test_repos.py
Show inline comments
 
new file 100644
 
from pylons_app.tests import *
 

	
 
class TestReposController(TestController):
 

	
 
    def test_index(self):
 
        response = self.app.get(url('repos'))
 
        # Test response...
 

	
 
    def test_index_as_xml(self):
 
        response = self.app.get(url('formatted_repos', format='xml'))
 

	
 
    def test_create(self):
 
        response = self.app.post(url('repos'))
 

	
 
    def test_new(self):
 
        response = self.app.get(url('new_repo'))
 

	
 
    def test_new_as_xml(self):
 
        response = self.app.get(url('formatted_new_repo', format='xml'))
 

	
 
    def test_update(self):
 
        response = self.app.put(url('repo', id=1))
 

	
 
    def test_update_browser_fakeout(self):
 
        response = self.app.post(url('repo', id=1), params=dict(_method='put'))
 

	
 
    def test_delete(self):
 
        response = self.app.delete(url('repo', id=1))
 

	
 
    def test_delete_browser_fakeout(self):
 
        response = self.app.post(url('repo', id=1), params=dict(_method='delete'))
 

	
 
    def test_show(self):
 
        response = self.app.get(url('repo', id=1))
 

	
 
    def test_show_as_xml(self):
 
        response = self.app.get(url('formatted_repo', id=1, format='xml'))
 

	
 
    def test_edit(self):
 
        response = self.app.get(url('edit_repo', id=1))
 

	
 
    def test_edit_as_xml(self):
 
        response = self.app.get(url('formatted_edit_repo', id=1, format='xml'))
pylons_app/tests/functional/test_users.py
Show inline comments
 
new file 100644
 
from pylons_app.tests import *
 

	
 
class TestUsersController(TestController):
 

	
 
    def test_index(self):
 
        response = self.app.get(url('users'))
 
        # Test response...
 

	
 
    def test_index_as_xml(self):
 
        response = self.app.get(url('formatted_users', format='xml'))
 

	
 
    def test_create(self):
 
        response = self.app.post(url('users'))
 

	
 
    def test_new(self):
 
        response = self.app.get(url('new_user'))
 

	
 
    def test_new_as_xml(self):
 
        response = self.app.get(url('formatted_new_user', format='xml'))
 

	
 
    def test_update(self):
 
        response = self.app.put(url('user', id=1))
 

	
 
    def test_update_browser_fakeout(self):
 
        response = self.app.post(url('user', id=1), params=dict(_method='put'))
 

	
 
    def test_delete(self):
 
        response = self.app.delete(url('user', id=1))
 

	
 
    def test_delete_browser_fakeout(self):
 
        response = self.app.post(url('user', id=1), params=dict(_method='delete'))
 

	
 
    def test_show(self):
 
        response = self.app.get(url('user', id=1))
 

	
 
    def test_show_as_xml(self):
 
        response = self.app.get(url('formatted_user', id=1, format='xml'))
 

	
 
    def test_edit(self):
 
        response = self.app.get(url('edit_user', id=1))
 

	
 
    def test_edit_as_xml(self):
 
        response = self.app.get(url('formatted_edit_user', id=1, format='xml'))
0 comments (0 inline, 0 general)