Skip to content

Commit

Permalink
Bump version to 0.9.1
Browse files Browse the repository at this point in the history
  • Loading branch information
bhch committed Oct 16, 2022
1 parent 63793eb commit 9f3f503
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 1 deletion.
13 changes: 13 additions & 0 deletions tests/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
"""Admin class for tests"""
from tornadmin.backends.base import BaseModelAdmin
from tornadmin.utils.text import split_camel, slugify

class TestModelAdmin(BaseModelAdmin):
def __init__(self, model, **kwargs):
name = model.__name__

self.model = model
self.name = kwargs.get('name', ' '.join(split_camel(name)))
self.slug = kwargs.get('slug', name.lower())
self.app = kwargs['app']
self.app_slug = slugify(self.app)
44 changes: 44 additions & 0 deletions tests/test_handlers.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
from unittest.mock import MagicMock
from tornado import testing, web, httputil
from tornadmin import BaseAdminSite, AdminRouter, uimodules

from admin import TestModelAdmin


class UserAdmin(TestModelAdmin):
pass

class UserModel(MagicMock):
__name__ = 'User'


class AdminSite(BaseAdminSite):
pass

admin_site = AdminSite(base_url='/admin')

admin_site.register(UserAdmin(model=UserModel, app='general', slug='user'))



app = web.Application(
[AdminRouter(admin_site)],
ui_modules=[uimodules],
debut=True,
)


class CommonHandlerTests(testing.AsyncHTTPTestCase):
def setUp(self):
list_route = '/admin/general/user/'
create_route = '/admin/general/user/add/'
delete_route = '/admin/general/'


class ListHandlerTests(testing.AsyncHTTPTestCase):
def get_app(self):
return app

def _test_list_headers(self):
# Must work with callables, string fields and methods
self.fetch('/admin/general/user')
2 changes: 1 addition & 1 deletion tornadmin/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from tornadmin.sites import BaseAdminSite


__version__ = "1.0.dev"
__version__ = "0.9.1"


__all__ = [
Expand Down

0 comments on commit 9f3f503

Please sign in to comment.