~paulgear/charms/trusty/quassel-core/trunk

« back to all changes in this revision

Viewing changes to tests/99-autogen

  • Committer: JosĂ© Antonio Rey
  • Date: 2015-01-09 18:59:13 UTC
  • mto: This revision was merged to the branch mainline in revision 18.
  • Revision ID: jose@ubuntu.com-20150109185913-zv1rltqylxal04s9
Added tests

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/env python3
 
2
 
 
3
import amulet
 
4
import requests
 
5
import unittest
 
6
 
 
7
 
 
8
class TestDeployment(unittest.TestCase):
 
9
    @classmethod
 
10
    def setUpClass(cls):
 
11
        cls.deployment = amulet.Deployment(series='trusty')
 
12
 
 
13
        cls.deployment.add('quassel-core')
 
14
 
 
15
        try:
 
16
            cls.deployment.setup(timeout=900)
 
17
            cls.deployment.sentry.wait()
 
18
        except amulet.helpers.TimeoutError:
 
19
            amulet.raise_status(amulet.SKIP, msg="Environment wasn't stood up in time")
 
20
        except:
 
21
            raise
 
22
 
 
23
    def test_case(self):
 
24
        # Now you can use self.deployment.sentry.unit[UNIT] to address each of
 
25
        # the units and perform more in-depth steps.  You can also reference
 
26
        # the first unit as self.unit.
 
27
        # There are three test statuses that can be triggered with
 
28
        # amulet.raise_status():
 
29
        #   - amulet.PASS
 
30
        #   - amulet.FAIL
 
31
        #   - amulet.SKIP
 
32
        # Each unit has the following methods:
 
33
        #   - .info - An array of the information of that unit from Juju
 
34
        #   - .file(PATH) - Get the details of a file on that unit
 
35
        #   - .file_contents(PATH) - Get plain text output of PATH file from that unit
 
36
        #   - .directory(PATH) - Get details of directory
 
37
        #   - .directory_contents(PATH) - List files and folders in PATH on that unit
 
38
        #   - .relation(relation, service:rel) - Get relation data from return service
 
39
        #          add tests here to confirm service is up and working properly
 
40
        # For example, to confirm that it has a functioning HTTP server:
 
41
        #     page = requests.get('http://{}'.format(self.unit.info['public-address']))
 
42
        #     page.raise_for_status()
 
43
        # More information on writing Amulet tests can be found at:
 
44
        #     https://juju.ubuntu.com/docs/tools-amulet.html
 
45
        pass
 
46
 
 
47
 
 
48
if __name__ == '__main__':
 
49
    unittest.main()