Fixed Bug418 #58
Loading…
Reference in New Issue
There is no content yet.
Delete Branch "Bug418-YAAQOB-MPIANA"
Deleting a branch is permanent. Although the deleted branch may exist for a short time before cleaning up, in most cases it CANNOT be undone. Continue?
Bug details can be found here: http://118.25.96.118/kanboard/?controller=TaskViewController&action=show&task_id=2738&project_id=170
@ -919,2 +918,3 @@
$sql = "INSERT INTO `course_ta`(`Course_ID`, `TA`) VALUES ('$id','$ta')";
// Check if the TA is already assigned to the course
$check_sql = "SELECT * FROM `course_ta` WHERE `Course_ID`='$id' AND `TA`='$ta'";
@yaaqob
Thanks. Why is the punctuation mark ` in `course_ta` needed?
@mrlan
I'm not sure myself, my teammate MPIANA wrote this part. However, it is working fine.
@mrlan
I made a new commit that edits MPIANA's code which is to remove the punctuation ( ` ) from the SQL statement as you suggested him to do, and I merged MPIANA's test cases with this branch.
Also MPIANA asked me to leave this answer to you here regarding why he added the punctuation:
"Backticks in SQL queries, like in the PHP code, ensure cross-database compatibility. They're a good practice for portability across different database systems, promoting coding standards."
@ -0,0 +9,4 @@
driver = webdriver.Chrome()
# Open the admin url
driver.get("http://localhost/itech/lrr/Admin.php")
@yaaqob
Please move this statement to the function body of
assign_ta_test()
.@ -0,0 +48,4 @@
tas = ["MPIANA", "KABWANGA", "mark"]
@pytest.mark.parametrize("course_name, ta_name", [(course, ta) for course in courses for ta in tas])
def assign_ta_test(course_name, ta_name):
@yaaqob
Please rename this function to
test_assign_TAs()
.@ -0,0 +62,4 @@
result_file.write(f"Course={course_name}, TA={ta_name}, Result={result}, Alert={alert_text}\n")
# Close the browser window
driver.quit()
@yaaqob
Are you sure
driver.quit()
will be executed if this script is run with this command:pytest assign_ta_test.py
?@ -0,0 +52,4 @@
alert_text = assign_ta(driver, course_name, ta_name)
try:
assert "Success" in alert_text or "Error" in alert_text
@yaaqob
Thanks
Why do you use OR logic to combine two different things:
assert "Success" in alert_text or "Error" in alert_text
?I believe these two cases should be separated.
@ -0,0 +51,4 @@
def assign_ta_test(course_name, ta_name):
alert_text = assign_ta(driver, course_name, ta_name)
try:
@yaaqob
I think the lines from 54-62 can be replaced with a single assert statement.
I don't see
try ... except
block in pytest test scripts quite often.If the assertion fails, pytest will tell us.
@ -0,0 +47,4 @@
courses = ["Python", "computer", "testing"]
tas = ["MPIANA", "KABWANGA", "mark"]
@pytest.mark.parametrize("course_name, ta_name", [(course, ta) for course in courses for ta in tas])
@yaaqob
Does this test the scenario that a TA is assigned to the same course twice?
@yaaqob
Thanks.
Could you sync your branch with the remote branch Hui-Organize, and then make a pull request that requests to merge to Hui-Organize?
See pull request 59 for one example.
Hui
Fixed Bug418to Fixed Bug418