2
# - send ipmi commands to turn on/off nodes
3
# - run import pxe files
4
# - check node states once they're on/off
5
# - check node state changes (declared -> commissionig -> ready)
7
from subprocess import check_output
9
from unittest import TestCase
11
from pyvirtualdisplay import Display
12
from sst.actions import (
13
assert_url, assert_text_contains, assert_title_contains, click_button,
14
get_element, go_to, write_textfield)
17
sys.path.insert(0, "/usr/share/maas")
18
os.environ['DJANGO_SETTINGS_MODULE'] = 'maas.settings'
19
from maasserver.models import User
21
MAAS_URL = "http://10.98.0.13/MAAS"
26
class TestMAASIntegration(TestCase):
29
self.display = Display(visible=0, size=(1280, 1024))
35
def createadmin(self):
36
"""Run sudo maas createsuperuser."""
37
cmd_output = check_output(
38
["sudo", "maas", "createsuperuser", "--username=%s" % ADMIN_USER,
39
"--email=example@canonical.com", "--noinput"])
40
## Set password for admin user.
42
admin = User.objects.get(username=ADMIN_USER)
43
except User.DoesNotExist:
44
admin = User(username=ADMIN_USER)
45
admin.set_password(PASSWORD)
49
def installation(self):
50
# Check the installation worked.
53
get_element(tag="body"), "No admin user has been created yet")
55
def createadmin_and_login(self):
56
## Creates the admin user.
57
output = self.createadmin()
58
self.assertEqual(output, 'Superuser created successfully.')
59
## Login with the newly created admin user
62
get_element(tag="body"), "Login to lenovo-RD230-01 MAAS")
63
write_textfield("id_username", ADMIN_USER)
64
write_textfield("id_password", PASSWORD)
67
assert_title_contains("Dashboard")
69
def test_integration(self):
70
# Run the integration tests in order.
72
self.createadmin_and_login()