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' })
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')
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')
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')
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')