15 Commits

Author SHA1 Message Date
c0bc65ed3d create TestHTTPClient that uses werkzueg test client, tests are passing
Some checks failed
continuous-integration/drone/pr Build is failing
continuous-integration/drone/push Build is passing
2021-07-31 15:28:42 -05:00
6d52f56d27 documenting the janky tests logs situation
Some checks failed
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is failing
2021-07-27 14:49:10 -05:00
f5640a1d01 getting unit tests to log properly
All checks were successful
continuous-integration/drone/push Build is passing
2021-07-27 14:44:10 -05:00
45d7e2c62e breaking up after abusive relationship with logger 2021-07-27 14:28:42 -05:00
56b00934be trying to do CaptureLogOutputDuringTestsFilter (but no worky yet)
Some checks failed
continuous-integration/drone/pr Build is failing
continuous-integration/drone/push Build is passing
2021-07-27 13:56:58 -05:00
aa67a1e1b2 blah failed attempts at getting tests to log 2021-07-27 13:28:49 -05:00
3fb8254c15 add debug test log
All checks were successful
continuous-integration/drone/push Build is passing
2021-07-27 12:50:50 -05:00
8a4794a344 trying to get tests to pass with hub_model=capsulflask
All checks were successful
continuous-integration/drone/push Build is passing
2021-07-27 12:48:48 -05:00
4cf11798aa remove redundant get_vms() and add testing documentation from pull
Some checks failed
continuous-integration/drone/pr Build is failing
continuous-integration/drone/push Build is passing
request
2021-07-27 12:02:48 -05:00
3wc
e1867eb430 Fix capsul create tests, post-test cleanup, tidy merge
Some checks failed
continuous-integration/drone/pr Build is failing
continuous-integration/drone/push Build is passing
2021-07-23 13:40:00 +02:00
62c7355b4c ensure that app is defined in app.py to fix login link logging issues.
Some checks failed
continuous-integration/drone/pr Build is failing
continuous-integration/drone/push Build is passing
also shuffled some things around for cleanliness
2021-07-23 03:02:17 +02:00
3wc
202d0aefff Disable VM creation check for the moment 2021-07-23 03:02:17 +02:00
3wc
01478dfd87 Add SSH key tests 2021-07-23 03:02:17 +02:00
3wc
a4837aff87 Initial console tests
NB capsul create isn't working properly, see #83
2021-07-23 03:02:17 +02:00
3wc
ecc8f885fa Basic testing using flask-testing
This commit makes it possible to override settings during tests, by
switching capsulflask/__init__.py to a "create_app" pattern, and using
`dotenv_values` instead of `load_dotenv`.

The create_app() method returns a Flask app instance, to give
more control over when to initialise the app. This allows setting
environment variables in test files.

Then, use dotenv_values to override loaded .env variables with ones from
the environment, so that tests can set `POSTGRES_CONNECTION_PARAMETERS`
and `SPOKE_MODEL` (possibly others in future..).

Inital tests for the "landing" pages, and login / activation, are
included.
2021-07-23 03:02:15 +02:00
6 changed files with 6 additions and 9 deletions

1
.gitignore vendored
View File

@ -11,7 +11,6 @@ instance/
.pytest_cache/ .pytest_cache/
.coverage .coverage
htmlcov/ htmlcov/
/unittest-log-output.log
dist/ dist/
build/ build/

View File

@ -108,8 +108,6 @@ def detail(id):
if vm is None: if vm is None:
return abort(404, f"{id} doesn't exist.") return abort(404, f"{id} doesn't exist.")
vm['ssh_username'] = current_app.config['SSH_USERNAME']
if vm['deleted']: if vm['deleted']:
return render_template("capsul-detail.html", vm=vm, delete=True, deleted=True) return render_template("capsul-detail.html", vm=vm, delete=True, deleted=True)

View File

@ -23,7 +23,7 @@ def pricing():
@bp.route("/faq") @bp.route("/faq")
def faq(): def faq():
return render_template("faq.html", ssh_username=current_app.config['SSH_USERNAME']) return render_template("faq.html")
@bp.route("/about-ssh") @bp.route("/about-ssh")
def about_ssh(): def about_ssh():

View File

@ -30,6 +30,6 @@ if virsh domuuid "$vmname" | grep -vqE '^[\t\s\n]*$'; then
fi fi
# this gets the ipv4 # this gets the ipv4
ipv4="$(virsh domifaddr "$vmname" | awk '/ipv4/ {print $4}' | cut -d'/' -f1)" ipv4="$(virsh domifaddr "$vmname" | awk '/vnet/ {print $4}' | cut -d'/' -f1)"
echo "$exists $state $ipv4" echo "$exists $state $ipv4"

View File

@ -97,7 +97,7 @@
</div> </div>
<div class="row justify-start"> <div class="row justify-start">
<label class="align" for="ssh_username">SSH Username</label> <label class="align" for="ssh_username">SSH Username</label>
<span id="ssh_username">{{ vm['ssh_username'] }}</span> <span id="ssh_username">cyberian</span>
</div> </div>
<div class="row justify-start"> <div class="row justify-start">
<label class="align" for="ssh_authorized_keys">SSH Authorized Keys</label> <label class="align" for="ssh_authorized_keys">SSH Authorized Keys</label>

View File

@ -21,13 +21,13 @@
</li> </li>
<li> <li>
How do I log in? How do I log in?
<p>ssh to the ip provided to you using the "{{ ssh_username }}" user.</p> <p>ssh to the ip provided to you using the cyberian user.</p>
<pre class='code'>$ ssh {{ ssh_username }}@1.2.3.4</pre> <pre class='code'>$ ssh cyberian@1.2.3.4</pre>
<p>For more information, see <a href="/about-ssh">Understanding the Secure Shell Protocol (SSH)</a>.</p> <p>For more information, see <a href="/about-ssh">Understanding the Secure Shell Protocol (SSH)</a>.</p>
</li> </li>
<li> <li>
How do I change to the root user? How do I change to the root user?
<p>The "{{ ssh_username }}" user has passwordless sudo access by default. This should work:</p> <p>The cyberian user has passwordless sudo access by default. This should work:</p>
<pre class='code'> <pre class='code'>
# Linux # Linux
$ sudo su - $ sudo su -