1/14
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
What is the purpose of a traceback in Flask debugging?
A traceback displays the sequence of function calls that led to an error, including the specific file and line number where the error occurred, helping quickly identify and diagnose problems.
Why should debug=True not be used in production for Flask apps?
Enabling debug=True in production exposes sensitive information, such as code snippets, file paths, and potentially secret variables, which attackers could exploit.
What does app.logger.info() do in a Flask app?
Records informational log messages that help track the application's behavior or specific events, appearing in the terminal for troubleshooting and analysis.
When should you use try/except blocks in Flask applications?
Use try/except blocks around code that may raise exceptions (e.g., database connections, external requests, parsing operations) to handle errors gracefully without crashing the app.
What is server-side validation and why is it important?
Server-side validation verifies submitted data on the server to ensure data integrity and prevent invalid or malicious input. It's essential for security and accurate data handling.
Where does validation typically occur in a Flask route that handles a form submission?
Validation typically occurs within the route function that processes the POST request right after retrieving form data, before database operations or business logic.
What is the role of errorList in Flask form validation logic?
errorList collects all validation error messages. If validation fails, this list is sent back to the template to inform users of all input errors at once.
Which condition correctly validates a position field that must be one of a few valid values?
if position not in ["Lecturer", "Sr. Lecturer", "Asst. Professor", "Professor"]
What does the Flask request.form.get("fName", 0) statement do?
Retrieves the value of the fName input field from a submitted form. If the field is missing, it defaults to 0.
In the test plan, what is the purpose of integration testing?
Integration testing verifies that combined components or units work correctly together by checking interactions and dependencies between modules.
What kind of testing involves simulating real user interactions in a browser?
End-to-End testing involves simulating real user interactions, validating complete user journeys in a real browser environment.
Which types of tests would most likely detect a SQL injection vulnerability?
Security testing and White Box testing, which analyze code for security flaws and vulnerabilities, would likely detect SQL injection vulnerabilities.
Why is regression testing important after new features are added?
Regression testing ensures new code or features haven't negatively impacted existing functionality, confirming the system remains stable.
What would be a correct test step to verify that a student cannot delete a course?
Attempting a delete operation using student credentials and verifying an error message or denial occurs, confirming permissions are enforced.
What components are typically tested during unit testing in a Flask application?
Individual functions, routes, database queries, helper methods, and logic units within the Flask app are tested to ensure isolated components function correctly.