mirror of
https://github.com/jazzband/django-admin2.git
synced 2026-04-30 19:44:46 +00:00
bike shedding
This commit is contained in:
parent
648d5e8d5b
commit
0e03d7a5b0
2 changed files with 43 additions and 4 deletions
|
|
@ -1 +1,35 @@
|
|||
# TODO - stub out tests
|
||||
from django.db import models
|
||||
from django.core.exceptions import ImproperlyConfigured
|
||||
from django.test import TestCase
|
||||
|
||||
from ..models import ModelAdmin2
|
||||
from ..core import Admin2
|
||||
|
||||
|
||||
class Thing(models.Model):
|
||||
pass
|
||||
|
||||
|
||||
class Admin2Test(TestCase):
|
||||
def setUp(self):
|
||||
self.admin2 = Admin2()
|
||||
|
||||
def test_register(self):
|
||||
self.admin2.register(Thing)
|
||||
self.assertTrue(isinstance(self.admin2.registry[Thing], ModelAdmin2))
|
||||
|
||||
def test_register_error(self):
|
||||
self.admin2.register(Thing)
|
||||
self.assertRaises(ImproperlyConfigured, self.admin2.register, Thing)
|
||||
|
||||
def test_deregister(self):
|
||||
self.admin2.register(Thing)
|
||||
self.admin2.deregister(Thing)
|
||||
self.assertTrue(Thing not in self.admin2.registry)
|
||||
|
||||
def test_deregister_error(self):
|
||||
self.assertRaises(ImproperlyConfigured, self.admin2.deregister, Thing)
|
||||
|
||||
def test_get_urls(self):
|
||||
self.admin2.register(Thing)
|
||||
self.assertEquals(4, len(self.admin2.get_urls()))
|
||||
|
|
|
|||
|
|
@ -153,10 +153,10 @@ django-admin2 pull requests should be as small/atomic as possible. Large, wide-s
|
|||
#. If you are fixing a view don't '*cleanup*' unrelated views. That cleanup belongs in another pull request.
|
||||
#. Changing permissions on a file should be in its own pull request with explicit reasons why.
|
||||
|
||||
Follow PEP-8 and keep your code simple!
|
||||
---------------------------------------
|
||||
Best Practices
|
||||
--------------
|
||||
|
||||
Memorize the Zen of Python::
|
||||
Follow PEP-0008 and memorize the Zen of Python::
|
||||
|
||||
>>> python -c 'import this'
|
||||
|
||||
|
|
@ -168,6 +168,11 @@ Furthermore, the pixel shortage is over. We want to see:
|
|||
* `grid` instead of `g`
|
||||
* `my_function_that_does_things` instead of `mftdt`
|
||||
|
||||
As much as possible, we follow the advice of the `Two Scoops of Django`_ book. Periodically the book will be referenced either for best practices or as a blunt object by the project lead in order to end bike-shedding.
|
||||
|
||||
.. _`Two Scoops of Django`: https://2scoops.org
|
||||
|
||||
|
||||
How pull requests are checked, tested, and done
|
||||
===============================================
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue