~phanatic/django-configglue/more-supported-releases

« back to all changes in this revision

Viewing changes to django_configglue/tests/test_configglue.py

  • Committer: Tarmac
  • Author(s): James Westby
  • Date: 2012-01-13 15:43:19 UTC
  • mfrom: (67.1.3 fix-argv)
  • Revision ID: tarmac@199959-20120113154319-murjtdc2tzdbuy1c
[r=ricardokirkner] Stop 'value' being added to argv when '--unknown-option=value' is passed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
import inspect
6
6
import textwrap
7
7
from cStringIO import StringIO
 
8
from optparse import BadOptionError
8
9
from unittest import TestCase
9
10
 
10
11
import django
27
28
from django.conf.project_template import settings as project_settings
28
29
from mock import patch
29
30
 
30
 
from django_configglue.management import GlueManagementUtility
 
31
from django_configglue.management import GlueManagementUtility, LaxOptionParser
31
32
from django_configglue.utils import (
32
33
    SETTINGS_ENCODING,
33
34
    configglue,
408
409
        self.assertTrue('Show settings attributes' in self.capture['stdout'])
409
410
 
410
411
 
 
412
class LaxOptionParserTestCase(TestCase):
 
413
 
 
414
    def test_explicit_value_for_unknown_option(self):
 
415
        parser = LaxOptionParser()
 
416
        rargs = ["--foo=bar"]
 
417
        self.assertRaises(BadOptionError, parser._process_long_opt, rargs, [])
 
418
        self.assertEqual([], rargs)
 
419
 
 
420
 
411
421
class UpperCaseDictOptionTestCase(TestCase):
412
422
    def test_parse(self):
413
423
        class MySchema(Schema):