aboutsummaryrefslogtreecommitdiff
path: root/ca/tests
diff options
context:
space:
mode:
authorRob Austein <sra@hactrn.net>2014-09-16 13:35:29 +0000
committerRob Austein <sra@hactrn.net>2014-09-16 13:35:29 +0000
commit7c2fb9ca36f120369797072e534041daae6cd8f9 (patch)
tree80f52c8a7f274461edd42bcd38d5bf4239de8ea7 /ca/tests
parent238c447318617fc42b38a0396ef9b05022ccfd90 (diff)
Add --browser switch to yamltest. Less useful than I had hoped it
might be due to some kind of CSRF problem, might be worth figuring out how to disable that for debugging but not terribly urgent. svn path=/branches/tk713/; revision=5955
Diffstat (limited to 'ca/tests')
-rw-r--r--ca/tests/yamltest.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/ca/tests/yamltest.py b/ca/tests/yamltest.py
index a18d287e..bc78c090 100644
--- a/ca/tests/yamltest.py
+++ b/ca/tests/yamltest.py
@@ -43,6 +43,7 @@ import re
import os
import logging
import argparse
+import webbrowser
import sys
import yaml
import signal
@@ -155,7 +156,7 @@ class allocation_db(list):
def __init__(self, yaml):
list.__init__(self)
self.root = allocation(yaml, self)
- assert self.root.is_root
+ assert self.root.is_root and not any(a.is_root for a in self if a is not self.root) and self[0] is self.root
if self.root.crl_interval is None:
self.root.crl_interval = 60 * 60
if self.root.regen_margin is None:
@@ -707,6 +708,8 @@ parser.add_argument("--profile", action = "store_true",
help = "enable profiling")
parser.add_argument("-g", "--run_gui", action = "store_true",
help = "enable GUI using django-admin runserver")
+parser.add_argument("--browser", action = "store_true",
+ help = "create web browser tabs for GUI")
parser.add_argument("yaml_file", type = argparse.FileType("r"),
help = "YAML description of test network")
args = parser.parse_args()
@@ -887,7 +890,14 @@ try:
print 'GUI user "root", password "fnord"'
for d in db:
if not d.is_hosted:
- print "GUI URL http://127.0.0.1:%d/rpki/ for %s" % (8000 + d.engine, d.name)
+ url = "http://127.0.0.1:%d/rpki/" % (8000 + d.engine)
+ print "GUI URL", url, "for", d.name
+ if args.browser:
+ if d is db.root:
+ webbrowser.open_new(url)
+ else:
+ webbrowser.open_new_tab(url)
+ time.sleep(2)
# Wait until something terminates.