def test_category_categoryForm(self): with app.test_request_context(): cgry_form = CategoryForm() cgry_form.title.data = "Test title" new_Category = Category(cgry_form) assert new_Category.title == cgry_form.title.data
def test_add_Category(self): with app.test_request_context(): cgry_form = CategoryForm() cgry_form.title.data = "Test title" new_Category = Category(cgry_form) db.session.add(new_Category) db.session.commit() fetchTestData = Category.query.filter_by(title="Test title").first() assert fetchTestData is not None
def test_add_Project(self): with app.test_request_context(): form = ProjectForm() form.title.data = "This is a test" form.category.data = "Test" form.start_date.data = "2012-12-12" form.end_date.data = "2013-12-12" form.description.data = "This is a test" form.supervisor.data = "Test" new_project = project(form, "Test program") db.session.add(new_project) db.session.commit() fetchTestData = project.query.filter_by(title="This is a test").first() assert fetchTestData is not None
def test_login_fail_function(self): with app.test_request_context(): response = self.login("*****@*****.**", 'password') assert 'Invalid e-mail or password' in response.data
def test_login_function(self): with app.test_request_context(): response = self.login("*****@*****.**", 'password') assert 'Admin dashboard' in response.data