Added db.drop_all() to the tearDownClass class.

Now we always start tests with a new DB

I tried to add some tests for form validation, but ran into a problem with the csrf_token.
The tests couldn't find it.
This is not a problem using the form for real.
It would be nice to figure this out.
This commit is contained in:
mike cullerton 2021-03-25 13:14:17 -04:00
parent ab776ea47d
commit 5371d204e5

View File

@ -25,7 +25,7 @@ class Sanity_Check_Test(unittest.TestCase):
@classmethod
def tearDownClass(cls):
pass
db.drop_all()
def setUp(self):
ExampleDataLoader().clean_db()
@ -164,3 +164,19 @@ class Sanity_Check_Test(unittest.TestCase):
study = self.add_study(title=title)
self.assertEqual(title, study.TITLE)
# def test_study_details_validation(self):
#
# test_study = self.add_study()
# data = {'IS_IND': 1, 'IND_1': 1234}
# r = self.app.post(f'/study_details/{test_study.STUDYID}', data=data, follow_redirects=False)
# self.assertNotIn('Form did not validate!', r.data.decode('utf-8'))
#
# print('test_study_details_validation')
#
# def test_study_details_validation_fail(self):
# test_study = self.add_study()
# data = {'IS_IND': 1, 'IND_1': 1234, 'IS_IDE': 'b'}
# r = self.app.post(f'/study_details/{test_study.STUDYID}', data=data, follow_redirects=False)
# self.assertIn('Form did not validate!', r.data.decode('utf-8'))
#
# print('test_study_details_validation_fail')