source: OpenRLabs-Git/web2py/applications/rlabs/unitTest/disabledTest/test_reserve_remotePC.py

main
Last change on this file was 42bd667, checked in by David Fuertes <dfuertes@…>, 4 years ago

Historial Limpio

  • Property mode set to 100644
File size: 1.4 KB
Line 
1#!/usr/bin/python3
2from fileinput import filename
3
4
5try:
6    import unittest2 as unittest #for Python <= 2.6
7except:
8    import unittest   
9
10import os
11import sys
12sys.path.append(os.path.dirname(sys.argv[0]) + '/') #Path to my unitTest directory
13from gluon import *
14
15from baseTest import BaseTest
16
17APP =sys.argv[1]
18
19
20
21#This line executes your controller file, bringing all of the function declarations into the local namespace.
22#execfile("applications/" + APP + "/controllers/default.py", globals())
23filename = "applications/" + APP + "/controllers/connectPC.py"
24
25exec(compile(open(filename, "rb").read(), filename, 'exec'), globals())
26
27import opengnsys
28
29class TestReserveRemotePC(BaseTest):
30   
31    def testReserveRemotePC(self):
32       
33        ou_id = '2' #eupt
34        lab_id = '6' #informatica1
35        image_id = '14' #Windows 10
36        pc_id = '36' # eupti115
37        maxtime = "1"
38                   
39        login_info = opengnsys.doLogin()
40        opengnsys.setApiKey(login_info['apikey'])     
41       
42        remotePC = opengnsys.reserveRemotePC(ou_id, lab_id, image_id, pc_id, maxtime)
43       
44        if 'id' in remotePC:
45            self.assertEqual(remotePC['id']  ,  pc_id)
46        if 'message' in remotePC:
47            self.assertRegex(remotePC['message']  ,  'Cannot access this resource')
48       
49
50
51suite = unittest.TestSuite()
52suite.addTest(unittest.makeSuite(TestReserveRemotePC))
53unittest.TextTestRunner(verbosity=2).run(suite)
Note: See TracBrowser for help on using the repository browser.