Ejemplo n.º 1
0
 def handle(self, *args, **options):
     """
     Handle, i.e., execute, the command given the command line arguments
     "args" and "options".
     """
     super(Command, self).handle(*args, **options)
     for name in options['attribute']:
         explain(name, stream=self.stdout)
Ejemplo n.º 2
0
 def test_ycexplain_a(self):
     """
     Documentation for an attribute
     """
     out = StringIO()
     django_yamlconf.explain("A", settings=self.settings, stream=out)
     self.assertIn('Example documentation for the attribute "A"',
                   out.getvalue())
Ejemplo n.º 3
0
 def test_ycexplain_b(self):
     """
     Explain expanded attribute
     """
     out = StringIO()
     django_yamlconf.explain("B", settings=self.settings, stream=out)
     self.assertIn('{A}', out.getvalue())
     self.assertIn('Value of A', out.getvalue())
Ejemplo n.º 4
0
 def test_ycexplain_missing(self):
     """
     Explain of unmanage attribute
     """
     out = StringIO()
     django_yamlconf.explain("X", settings=self.settings, stream=out)
     self.assertIn('The setting "X" is not managed by YAMLCONF',
                   out.getvalue())
Ejemplo n.º 5
0
 def test_ycexplain_not_managed(self):
     """
     Explain when YAMLCONF not initialized
     """
     if hasattr(self, "assertLogs"):
         with self.assertLogs('', level='ERROR') as logs:
             django_yamlconf.explain(
                 "X",
                 settings=MockSettings(),
                 stream=StringIO(),
             )
             self.assertIn('No YAMLCONF attributes defined', logs.output[0])