blah failed attempts at getting tests to log

This commit is contained in:
2021-07-27 13:28:49 -05:00
committed by 3wc
parent 140870ec35
commit 4e510ebb01
2 changed files with 25 additions and 4 deletions

View File

@ -1,3 +1,5 @@
import logging
from copy import deepcopy
from unittest.mock import patch
@ -80,6 +82,10 @@ class ConsoleTests(BaseTestCase):
len(get_model().list_vms_for_account('test@example.com')),
0
)
file_object = open('unittest-output.log', 'a')
file_object.write(f"{self.id()} captured output:\n{self.logs_from_test.getvalue()}\n")
file_object.close()
def test_create_fails_invalid(self):
with self.client as client:
@ -129,7 +135,7 @@ class ConsoleTests(BaseTestCase):
)
vm_id = vms[0]['id']
self.assertRedirects(
response,
url_for("console.index") + f'?created={vm_id}'
@ -190,10 +196,12 @@ class ConsoleTests(BaseTestCase):
)
def setUp(self):
super().setUp()
self._login('test@example.com')
get_model().create_ssh_public_key('test@example.com', 'key', 'foo')
def tearDown(self):
super().tearDown()
get_model().cursor.execute("DELETE FROM ssh_public_keys")
get_model().cursor.execute("DELETE FROM login_tokens")
get_model().cursor.execute("DELETE FROM vms")