UNPKG

2.31 kBJavaScriptView Raw
1// Jasmine test related to the vmauthor virtual machine. The vmauthor
2// virtual machine hosts a full constellation of CodeGradX servers.
3// The vmauthor virtual machine is available from
4// http://paracamplus.com/CodeGradX/VM/latest/
5
6var CodeGradX = require('codegradxlib');
7var Agent = require('../codegradxagent.js');
8var vmauthor = require('./vmauthor-data.js');
9var vmauthData = require('./vmauth-data.json');
10
11describe("CodeGradXagent process Job", function () {
12
13 function initializer (agent) {
14 // User VMauthor's servers:
15 agent.state = new CodeGradX.State(vmauthor.initialize);
16 return agent;
17 }
18
19 it("should be loaded", function () {
20 expect(Agent).toBeDefined();
21 var agent = new CodeGradX.Agent(initializer);
22 expect(agent).toBeDefined();
23 });
24
25 function make_faildone (done) {
26 return function faildone (reason) {
27 //agent.state.debug(reason).show();
28 //console.log(reason);
29 fail(reason);
30 done();
31 };
32 }
33
34 var exerciseTGZFile1 = "spec/org.example.fw4ex.grading.check.tgz";
35
36 it("should submit another exercise and resume it", function (done) {
37 var agent = CodeGradX.getCurrentAgent();
38 expect(agent).toBeDefined();
39 var faildone = make_faildone(done);
40 agent.process([
41 "-V",
42 "--user", vmauthData.login,
43 "--password", vmauthData.password,
44 "--update-credentials",
45 "--type", 'exercise',
46 "--stuff", exerciseTGZFile1,
47 "--counter", 350,
48 "--timeout", 3,
49 "--retry", 2
50 ]).then(function (exercise) {
51 expect(exercise).toBeDefined();
52 agent.process([
53 "-v",
54 "--resume", '351-exerciseSubmittedReport.xml',
55 "--follow"
56 ]).then(function (exercise2) {
57 expect(exercise2.pseudojobs).toBeDefined();
58 expect(exercise2.pseudojobs.perfect).toBeDefined();
59 expect(exercise2.pseudojobs.perfect.mark).toBe(100);
60 // Normally 35[23]-exerciseAuthorReport.xml are equal
61 done();
62 }, faildone);
63 }, faildone);
64 }, 400*1000); // 400 seconds
65
66});