cereal-lab / EvoPIE

Evolutionary Peer Instruction Environment

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Extensive tests return 405 Method not allowed

dvitel opened this issue · comments

After merge #61 it happen that extensive tests are not working. Obtained diff file:

1,4c1,20
< <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
< <title>405 Method Not Allowed</title>
< <h1>Method Not Allowed</h1>
< <p>The method is not allowed for the requested URL.</p>
---
> Last Name,First Name,Email,Initial Score,Revised Score,Grade for Justifications,Grade for Participation,Likes Given,Likes Received,Total Score,Final Percentage
> 8,BB,student7@usf.edu,2,2,5,1,19,0,2.2 / 5.1,43.1%
...

Problems:

@auth.route('/signup', methods=['POST'])
def post_signup():
if request.json:

and
@pages.route("/getDataCSV/<int:qid>", methods=['POST'])

have POST method, not specified in CURL in
curl -L -c ./mycookies -d "$DATA" -H "Content-Type: application/json" "http://127.0.0.1:5000$TARGET_PATH" &>/dev/null
if [[ $? == 0 ]]
then

Also, after merge in order to complete file download,
additional request to endpoint /grades/{{ quiz.id }}/justificationGrade is necessary

document.addEventListener("DOMContentLoaded", function() {
var table = $('#gradingtable').DataTable();
let justification_grade, total_scores;
document.querySelector('#loadJustificationGrade').addEventListener('click', function(event) {
let target_url = '/grades/{{ quiz.id }}/justificationGrade';
let spinner = document.querySelector('.spinner');
$('.spinner-border').removeClass('spinner');
table.page.len( -1 ).draw();
fetch(target_url,{
method: 'GET',
headers: {'Content-Type' : 'application/json'},
credentials: 'same-origin'
})
.then(response => response.json())
.then(
data => {
justification_grade = data[0];
total_scores = data[1];
console.log(justification_grade)
jgrades = justification_grade;
for (let id of Object.keys(justification_grade)) {
let e = document.querySelector('#justification_grade-' + id);
if (e) {
e.innerHTML = justification_grade[id];
}
let total_score = document.querySelector('#total_score-' + id);
let final_percentage = document.querySelector('#final_percentage-' + id);
if (total_score) {
total_score.innerHTML = total_scores[id] + " / " + total_scores[-1];
}
if (final_percentage) {
final_percentage.innerHTML = Math.round( ( (total_scores[id] / total_scores[-1]) * 100 ) * 100 ) / 100 + "%";
}
}
$('.spinner-border').addClass('spinner');
table.page.len( 10 ).draw();
}
)
})
document.querySelector('#download-csv').addEventListener('click', function(event) {
let target_url = '/getDataCSV/{{ quiz.id }}';
fetch(target_url, {

I did fix of TestLib.sh 8912c71
Now test returns data but different from expected - please see commit details.

@dvitel could you please apply the same fix to the "Easy labels" folder in tests as well?

Done "Easy labels" and merge a18de7f