Browse Source
Port the python2.7 local settings overrides to the python3.6 directory structure. Move all local_settings.py overrides into _05_snap_tweaks.py as part of troubleshooting some remaining problems. Everything is more organized and functional now :-) Added selenium tests. Change-Id: I54923e1dc9c7ffa47c2ef6fb90ea9d224b0d2eeechanges/71/679871/20
23 changed files with 174 additions and 54 deletions
@ -1,22 +0,0 @@
|
||||
# Tweaks to make this run nicely in a snap. |
||||
|
||||
# We don't want django to try writing the secret key before we've told |
||||
# it not to attempt to write it out in the read only snap dir in our |
||||
# local_settings.py. So we override the behavior of the default |
||||
# settings.py here. |
||||
SECRET_KEY = "overridethis!" |
||||
|
||||
# Django wants to write out compressed files even when we turn |
||||
# compression off (either a bug or something that I'm not |
||||
# understanding). Tell it to write them some place writeable. |
||||
STATIC_ROOT = '/var/snap/microstack/common/var/horizon/static' |
||||
|
||||
# Disable extra themes for now. TODO: Re-enable when |
||||
# https://github.com/CanonicalLtd/microstack/issues/39 is |
||||
# addressed. (You'll need to uncomment the material theme below when testing |
||||
# the fix.) |
||||
AVAILABLE_THEMES = [ |
||||
('default', 'Default', 'themes/default'), |
||||
# ('material', 'Material', 'themes/material'), |
||||
('ubuntu', 'Ubuntu', 'themes/ubuntu'), |
||||
] |
@ -0,0 +1,53 @@
|
||||
# Tweaks to make this run nicely in a snap. |
||||
|
||||
# TODO: turn this off once everything is working nicely. |
||||
DEBUG = True |
||||
|
||||
# Set our webroot. |
||||
WEBROOT = '/' |
||||
|
||||
# Caches and such should get written out here. |
||||
LOCAL_PATH = '/var/snap/microstack/common/etc/horizon/' |
||||
|
||||
# We don't want django to try writing the secret key before we've told |
||||
# it not to attempt to write it out in the read only snap dir in our |
||||
# local_settings.py. So we override the behavior of the default |
||||
# settings.py here. |
||||
SECRET_KEY = secret_key.generate_or_read_from_file( |
||||
os.path.join(LOCAL_PATH, '.secret_key_store')) |
||||
|
||||
# Django wants to write out compressed files even when we turn |
||||
# compression off (either a bug or something that I'm not |
||||
# understanding). Tell it to write them some place writeable. |
||||
STATIC_ROOT = '/var/snap/microstack/common/var/horizon/static' |
||||
|
||||
# Disable extra themes for now. TODO: Re-enable when |
||||
# https://github.com/CanonicalLtd/microstack/issues/39 is |
||||
# addressed. (You'll need to uncomment the material theme below when testing |
||||
# the fix.) |
||||
AVAILABLE_THEMES = [ |
||||
('default', 'Default', 'themes/default'), |
||||
# ('material', 'Material', 'themes/material'), |
||||
('ubuntu', 'Ubuntu', 'themes/ubuntu'), |
||||
] |
||||
|
||||
# Point us at keystone. |
||||
OPENSTACK_HOST = "10.20.20.1" |
||||
OPENSTACK_KEYSTONE_URL = "http://%s:5000/v3" % OPENSTACK_HOST |
||||
OPENSTACK_KEYSTONE_DEFAULT_ROLE = "_member_" |
||||
|
||||
# Turn off external access for now. (This should be turned on once we |
||||
# have hooks for setting a non default password.) |
||||
ALLOWED_HOSTS = ['10.20.20.1', 'localhost', '127.0.0.1'] |
||||
|
||||
# Use memcached as our caching backend. |
||||
CACHES = { |
||||
'default': { |
||||
# |
||||
'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache', |
||||
'LOCATION': '10.20.20.1:11211', |
||||
} |
||||
} |
||||
SESSION_ENGINE='django.contrib.sessions.backends.cache' |
||||
|
||||
|
Before Width: | Height: | Size: 90 KiB After Width: | Height: | Size: 90 KiB |
Before Width: | Height: | Size: 5.1 KiB After Width: | Height: | Size: 5.1 KiB |
Before Width: | Height: | Size: 5.1 KiB After Width: | Height: | Size: 5.1 KiB |
@ -0,0 +1,47 @@
|
||||
#!/usr/bin/env python |
||||
""" |
||||
test_horizonlogin.py |
||||
|
||||
This is a basic test of Horizon functionality. We verify that: |
||||
|
||||
1) Horizon is running, and we can hit the landing page. |
||||
2) We can login successfully. |
||||
|
||||
This is based on code generated by the Selinum Web IDE. |
||||
|
||||
""" |
||||
|
||||
import os |
||||
import socket |
||||
import unittest |
||||
import xvfbwrapper |
||||
from selenium import webdriver |
||||
from selenium.webdriver.common.by import By |
||||
|
||||
|
||||
class TestHorizonlogin(unittest.TestCase): |
||||
def setUp(self): |
||||
self.display = xvfbwrapper.Xvfb(width=1280, height=720) |
||||
self.display.start() |
||||
self.driver = webdriver.PhantomJS() |
||||
|
||||
def tearDown(self): |
||||
self.driver.quit() |
||||
self.display.stop() |
||||
|
||||
def test_horizonlogin(self): |
||||
self.driver.get("http://10.20.20.1/") |
||||
# Login to horizon! |
||||
self.driver.find_element(By.ID, "id_username").click() |
||||
self.driver.find_element(By.ID, "id_username").send_keys("admin") |
||||
self.driver.find_element(By.ID, "id_password").send_keys("keystone") |
||||
self.driver.find_element(By.CSS_SELECTOR, "#loginBtn > span").click() |
||||
# Verify that we can click something on the dashboard -- e.g., |
||||
# we're still not sitting at the login screen. |
||||
self.driver.find_element(By.LINK_TEXT, "Images").click() |
||||
|
||||
if __name__ == '__main__': |
||||
# Run our tests, ignorning deprecation warnings and warnings about |
||||
# unclosed sockets. (TODO: setup a selenium server so that we can |
||||
# move from PhantomJS, which is deprecated, to to Selenium headless.) |
||||
unittest.main(warnings='ignore') |
Loading…
Reference in new issue