~teknico/charms/precise/juju-gui/integrate-builtin-server

« back to all changes in this revision

Viewing changes to tests/test_utils.py

  • Committer: Nicola Larosa
  • Date: 2013-08-07 15:08:16 UTC
  • Revision ID: nicola.larosa@canonical.com-20130807150816-k0y228eqdvpbpdwv
Clean up exports and path usage in tests.

Show diffs side-by-side

added added

removed removed

Lines of Context:
384
384
 
385
385
    def setUp(self):
386
386
        self.zookeeper_address = 'example.com:2000'
387
 
        contents = 'env JUJU_ZOOKEEPER="{0}"\n'.format(self.zookeeper_address)
 
387
        contents = 'env JUJU_ZOOKEEPER="{}"\n'.format(self.zookeeper_address)
388
388
        with tempfile.NamedTemporaryFile(delete=False) as agent_file:
389
389
            agent_file.write(contents)
390
390
            self.agent_file_path = agent_file.name
682
682
    def test_setup_haproxy_config(self):
683
683
        setup_haproxy_config(self.ssl_cert_path)
684
684
        haproxy_conf = self.files['haproxy.cfg']
685
 
        self.assertIn('ca-base {0}'.format(self.ssl_cert_path), haproxy_conf)
686
 
        self.assertIn('crt-base {0}'.format(self.ssl_cert_path), haproxy_conf)
687
 
        self.assertIn('ws1 127.0.0.1:{0}'.format(API_PORT), haproxy_conf)
688
 
        self.assertIn('web1 127.0.0.1:{0}'.format(WEB_PORT), haproxy_conf)
689
 
        self.assertIn('ca-file {0}'.format(JUJU_PEM), haproxy_conf)
690
 
        self.assertIn('crt {0}'.format(JUJU_PEM), haproxy_conf)
 
685
        self.assertIn('ca-base {}'.format(self.ssl_cert_path), haproxy_conf)
 
686
        self.assertIn('crt-base {}'.format(self.ssl_cert_path), haproxy_conf)
 
687
        self.assertIn('ws1 127.0.0.1:{}'.format(API_PORT), haproxy_conf)
 
688
        self.assertIn('web1 127.0.0.1:{}'.format(WEB_PORT), haproxy_conf)
 
689
        self.assertIn('ca-file {}'.format(JUJU_PEM), haproxy_conf)
 
690
        self.assertIn('crt {}'.format(JUJU_PEM), haproxy_conf)
691
691
        self.assertIn('redirect scheme https', haproxy_conf)
692
692
 
693
693
    def test_remove_haproxy_setup(self):
698
698
        setup_apache_config(self.build_dir, serve_tests=True)
699
699
        apache_site_conf = self.files['SITE_NOT_THERE']
700
700
        self.assertIn('juju-gui/build-', apache_site_conf)
701
 
        self.assertIn('VirtualHost *:{0}'.format(WEB_PORT), apache_site_conf)
 
701
        self.assertIn('VirtualHost *:{}'.format(WEB_PORT), apache_site_conf)
702
702
        self.assertIn(
703
 
            'Alias /test {0}/test/'.format(JUJU_GUI_DIR), apache_site_conf)
 
703
            'Alias /test {}/test/'.format(JUJU_GUI_DIR), apache_site_conf)
704
704
        apache_ports_conf = self.files['PORTS_NOT_THERE']
705
705
        self.assertIn('NameVirtualHost *:8000', apache_ports_conf)
706
706
        self.assertIn('Listen 8000', apache_ports_conf)