Skip to content

Commit

Permalink
Add more tests and improve logging with tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
pmac committed Aug 25, 2012
1 parent 3350397 commit 82ed863
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 6 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ settings/local.py
*.sublime*
.coverage
_coverage/*
.noseids

1 change: 1 addition & 0 deletions requirements-base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ git+https://github.com/auzigog/jinja-bootstrap.git@v0.3.0
Markdown==2.2.0
nose
django-nose
nose-progressive
pytz==2012d
django-cronjobs==0.2.3
django-model-utils==1.1.0
27 changes: 24 additions & 3 deletions scrum/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,19 +131,40 @@ def test_db_bugs(self):


class TestBugzillaURL(TestCase):
def setUp(self):
self.bzurl = ('https://bugzilla.mozilla.org/buglist.cgi?'
'product=Mozilla%20Developer%20Network')

def test_bz_args(self):
"""
args should be added for bug status and whiteboard
:return:
"""
bzurl = ('https://bugzilla.mozilla.org/buglist.cgi?'
'product=Mozilla%20Developer%20Network')
statuses = set(['UNCONFIRMED', 'ASSIGNED', 'REOPENED', 'NEW'])
url = BugzillaURL(url=bzurl)
url = BugzillaURL(url=self.bzurl)
args = url._get_bz_args()
self.assertSetEqual(set(args.getlist('bug_status')), statuses)
eq_(args['status_whiteboard'], 'u= c= p=')

def test_url_args_override_defaults(self):
"""
You should still be able to specify your own statuses and whiteboard.
"""
url = BugzillaURL(url=self.bzurl + ';bug_status=CLOSED'
';status_whiteboard=u%3Dthedude')
args = url._get_bz_args()
eq_(args['bug_status'], 'CLOSED')
eq_(args['status_whiteboard'], 'u=thedude')

def test_url_args_not_modified(self):
"""
Setting the proper arguments turns off automatic args addition.
"""
url = BugzillaURL(url=self.bzurl)
args = url._get_bz_args(open_only=False, scrum_only=False)
ok_('bug_status' not in args)
ok_('status_whiteboard' not in args)


class TestProject(TestCase):
fixtures = ['test_data.json']
Expand Down
11 changes: 8 additions & 3 deletions settings/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,19 @@
DEFAULT_LOG_LEVEL = 'DEBUG' if DEBUG else 'INFO'
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'disable_existing_loggers': True,
'filters': {
'require_debug_false': {
'()': 'django.utils.log.RequireDebugFalse',
},
},
'formatters': {
'verbose': {
'format': ('%(levelname)s %(asctime)s %(module)s %(process)d '
'format': ('%(levelname)s %(asctime)s %(name)s %(process)d '
'%(thread)d %(message)s'),
},
'simple': {
'format': '%(levelname)s %(asctime)s %(module)s %(message)s',
'format': '%(levelname)s %(asctime)s %(name)s %(message)s',
},
},
'handlers': {
Expand Down Expand Up @@ -59,6 +59,11 @@
'level': 'ERROR',
'propagate': False,
},
'nose': {
'handlers': ['null'],
'level': 'DEBUG',
'propagate': False,
},
'': {
'handlers': ['console'],
'level': os.environ.get('SCRUM_LOG_LEVEL', DEFAULT_LOG_LEVEL),
Expand Down
3 changes: 3 additions & 0 deletions settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,3 +141,6 @@
)

TEST_RUNNER = 'django_nose.NoseTestSuiteRunner'
NOSE_ARGS = [
'--logging-clear-handlers',
]
7 changes: 7 additions & 0 deletions settings/local.py-dist
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,10 @@ CACHES = {
}

SOUTH_TESTS_MIGRATE = False

# add more nosetest arguments if you want. defaults are in base.py
#NOSE_ARGS += [
# '--stop',
# '--failed',
# '--with-progressive',
#]

0 comments on commit 82ed863

Please sign in to comment.