Example #1
0
 def test_additional_context(self):
     "Pass additional context to the template."
     supervisor.upload_gunicorn_conf(context={'foo': 'bar'})
     self.assertTemplateContext({
         'app_name': 'gunicorn',
         'command': 'gunicorn',
         'foo': 'bar'
     })
Example #2
0
 def test_alternate_app_name(self):
     "Use another app name for the gunicorn command."
     supervisor.upload_gunicorn_conf(app_name='server-2')
     self.assertTemplateContext({
         'app_name': 'server-2',
         'command': 'gunicorn'
     })
     self.assertTemplateUsed(
         [u'supervisor/gunicorn.conf', u'supervisor/gunicorn.conf'])
     self.assertTemplateDesination(u'/etc/supervisor/conf.d/server-2.conf')
Example #3
0
 def test_alternate_command(self):
     "Upload template for another gunicorn command."
     supervisor.upload_gunicorn_conf(command='gunicorn_django')
     self.assertTemplateContext({
         'app_name': 'gunicorn_django',
         'command': 'gunicorn_django'
     })
     self.assertTemplateUsed(
         [u'supervisor/gunicorn_django.conf', u'supervisor/gunicorn.conf'])
     self.assertTemplateDesination(
         u'/etc/supervisor/conf.d/gunicorn_django.conf')
Example #4
0
 def test_default_upload(self):
     "Upload default configuration."
     supervisor.upload_gunicorn_conf()
     # Default context
     self.assertTemplateContext({
         'app_name': 'gunicorn',
         'command': 'gunicorn'
     })
     # Upload template will look for templates in the given order
     self.assertTemplateUsed(
         [u'supervisor/gunicorn.conf', u'supervisor/gunicorn.conf'])
     self.assertTemplateDesination(u'/etc/supervisor/conf.d/gunicorn.conf')
     self.assertSudoCommand('supervisorctl update')
Example #5
0
 def test_alternate_template_name(self):
     "Change default template search."
     supervisor.upload_gunicorn_conf(template_name=u'bar.conf')
     self.assertTemplateUsed(u'bar.conf')
     self.assertTemplateDesination(u'/etc/supervisor/conf.d/gunicorn.conf')