~patrick-hetu/charms/precise/python-django/trunk

« back to all changes in this revision

Viewing changes to tests/01_deploy.test

  • Committer: Patrick Hetu
  • Date: 2013-05-15 16:12:22 UTC
  • Revision ID: patrick.hetu@gmail.com-20130515161222-twzwqn13l3obva4a
makeĀ usableĀ tests

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
from helpers import (
6
6
    command,
7
7
    make_charm_config_file,
8
 
    maintain_charm_revision,
9
8
    unit_info,
10
 
    upgrade_charm,
11
9
    wait_for_page_contents,
12
 
    wait_for_unit,
13
10
    )
14
 
import os.path
15
 
import time
16
11
import unittest
17
12
 
18
13
juju = command('juju')
20
15
 
21
16
class TestCharm(unittest.TestCase):
22
17
 
23
 
#    def tearDown(self):
24
 
#        juju('destroy-service', 'postgresql')
25
 
#        juju('destroy-service', 'python-django')
26
 
#        juju('destroy-service', 'gunicorn')
 
18
    def tearDown(self):
 
19
        juju('destroy-service', 'postgresql')
 
20
        juju('destroy-service', 'python-django')
 
21
        juju('destroy-service', 'gunicorn')
27
22
 
28
23
    def deploy(self, charm_config=None):
29
24
        if charm_config is not None:
30
25
            charm_config_file = make_charm_config_file(charm_config)
31
 
        juju('deploy', '--repository', '../', 'local:postgresql')
32
 
        juju('deploy', '--repository', '../', '--config=' + charm_config_file.name, 'local:python-django')
 
26
        juju('deploy', 'postgresql')
 
27
        juju('deploy', '--config=' + charm_config_file.name, 'python-django')
33
28
        juju('deploy', 'gunicorn')
34
29
        juju('add-relation', 'python-django:db', 'postgresql:db')
35
30
        juju('add-relation', 'python-django', 'gunicorn')
43
38
 
44
39
    def get_config(self):
45
40
        return {
46
 
            'vcs': 'bzr',
47
 
            'repos_url': "lp:~patrick-hetu/+junk/paste_site",
48
41
            'site_secret_key': 'abcdefghijklmmnopqrstuvwxyz'
49
42
        }
50
43
 
54
47
        self.deploy(self.get_config())
55
48
        self.expose_and_check_page()
56
49
 
57
 
#    def test_lpbuildbot(self):
58
 
        # Deploying a Launchpad-specific buildbot master does a good job of
59
 
        # exercising the configuration parameters.  For example, the
60
 
        # configuration in this test adds a repository (lucid main universe),
61
 
        # installs a non-default buildbot package, and fetches the buildbot
62
 
        # configuration from bzr.
63
 
#        charm_config = {
64
 
#            'python-django': {
65
 
#                'vcs': 'bzr',
66
 
#            }}
67
 
#        self.deploy(charm_config)
68
 
#        self.expose_and_check_page()
69
 
 
70
 
#    def test_upgrade_charm(self):
71
 
        # Ensure the charm can be upgraded without errors.
72
 
#        self.deploy(self.get_config())
73
 
#        with maintain_charm_revision():
74
 
#            upgrade_charm('python-django')
75
 
        # Wait for the charm to upgrade using sleep, since there is no
76
 
        # other confirmation at the moment but the state to remain 'started'.
77
 
#        time.sleep(10)
78
 
#        self.expose_and_check_page()
79
 
 
80
 
 
81
50
if __name__ == '__main__':
82
51
    unittest.main()