MCPcopy Create free account
hub / github.com/PrairieLearn/PrairieLearn / getAssessments

Function getAssessments

tests/testAccess.js:173–191  ·  view source on GitHub ↗
(cookies, shouldContainE1, callback)

Source from the content-addressed store, hash-verified

171 /**********************************************************************/
172
173 var getAssessments = function(cookies, shouldContainE1, callback) {
174 request({url: assessmentsUrl, jar: cookies}, function (error, response, body) {
175 if (error) {
176 return callback(error);
177 }
178 if (response.statusCode != 200) {
179 return callback(new Error('bad status: ' + response.statusCode));
180 }
181 page = body;
182 try {
183 $ = cheerio.load(page);
184 elemList = $('td a:contains("Exam for automatic test suite")');
185 assert.lengthOf(elemList, shouldContainE1 ? 1 : 0);
186 } catch (err) {
187 return callback(err);
188 }
189 callback(null);
190 });
191 };
192
193 describe('6. GET /pl/assessments', function() {
194 it('as student should not contain E1', function(callback) {

Callers 1

testAccess.jsFile · 0.85

Calls 2

callbackFunction · 0.85
$Function · 0.50

Tested by

no test coverage detected