Merge lp:~mbruzek/charms/precise/openerp-web/tests into lp:charms/openerp-web

Proposed by Matt Bruzek
Status: Merged
Merged at revision: 27
Proposed branch: lp:~mbruzek/charms/precise/openerp-web/tests
Merge into: lp:charms/openerp-web
Diff against target: 71 lines (+61/-0)
2 files modified
tests/00-setup (+5/-0)
tests/99-autogen (+56/-0)
To merge this branch: bzr merge lp:~mbruzek/charms/precise/openerp-web/tests
Reviewer Review Type Date Requested Status
charmers Pending
Review via email: mp+241011@code.launchpad.net

Commit message

Adding tests for this charm

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== added directory 'tests'
=== added file 'tests/00-setup'
--- tests/00-setup 1970-01-01 00:00:00 +0000
+++ tests/00-setup 2014-11-06 22:38:24 +0000
@@ -0,0 +1,5 @@
1#!/bin/bash
2
3sudo add-apt-repository ppa:juju/stable -y
4sudo apt-get update
5sudo apt-get install amulet python3-requests -y
06
=== added file 'tests/99-autogen'
--- tests/99-autogen 1970-01-01 00:00:00 +0000
+++ tests/99-autogen 2014-11-06 22:38:24 +0000
@@ -0,0 +1,56 @@
1#!/usr/bin/env python3
2
3import amulet
4import requests
5import unittest
6
7
8class TestDeployment(unittest.TestCase):
9 @classmethod
10 def setUpClass(cls):
11 cls.deployment = amulet.Deployment(series='precise')
12
13 cls.deployment.add('openerp-web')
14 cls.deployment.add('postgresql')
15 cls.deployment.add('openerp-server')
16 cls.deployment.configure('openerp-server', {'admin_passwd': 'passw0rd'})
17 cls.deployment.relate('openerp-web:website', 'apache2')
18 cls.deployment.relate('openerp-server:db', 'postgresql:db-admin')
19 cls.deployment.relate('openerp-web:openerp', 'openerp-server:openerp')
20 cls.deployment.expose('openerp-server')
21
22 try:
23 cls.deployment.setup(timeout=900)
24 cls.deployment.sentry.wait()
25 except amulet.helpers.TimeoutError:
26 amulet.raise_status(amulet.SKIP, msg="Environment wasn't stood up in time")
27 except:
28 raise
29
30 def test_case(self):
31 # Now you can use self.deployment.sentry.unit[UNIT] to address each of
32 # the units and perform more in-depth steps. You can also reference
33 # the first unit as self.unit.
34 # There are three test statuses that can be triggered with
35 # amulet.raise_status():
36 # - amulet.PASS
37 # - amulet.FAIL
38 # - amulet.SKIP
39 # Each unit has the following methods:
40 # - .info - An array of the information of that unit from Juju
41 # - .file(PATH) - Get the details of a file on that unit
42 # - .file_contents(PATH) - Get plain text output of PATH file from that unit
43 # - .directory(PATH) - Get details of directory
44 # - .directory_contents(PATH) - List files and folders in PATH on that unit
45 # - .relation(relation, service:rel) - Get relation data from return service
46 # add tests here to confirm service is up and working properly
47 # For example, to confirm that it has a functioning HTTP server:
48 # page = requests.get('http://{}'.format(self.unit.info['public-address']))
49 # page.raise_for_status()
50 # More information on writing Amulet tests can be found at:
51 # https://juju.ubuntu.com/docs/tools-amulet.html
52 pass
53
54
55if __name__ == '__main__':
56 unittest.main()

Subscribers

People subscribed via source and target branches

to all changes: