source: OpenRLabs-Git/web2py/applications/rlabs/unitTest/disabledTest/test_events.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.6 KB
Line 
1#!/usr/bin/python3
2import clients
3import opengnsys
4
5from fileinput import filename
6
7
8
9try:
10    import unittest2 as unittest #for Python <= 2.6
11except:
12    import unittest   
13
14import os
15import sys
16sys.path.append(os.path.dirname(sys.argv[0]) + '/') #Path to my unitTest directory
17from gluon import *
18
19from baseTest import BaseTest
20
21APP =sys.argv[1]
22
23
24
25#This line executes your controller file, bringing all of the function declarations into the local namespace.
26#execfile("applications/" + APP + "/controllers/default.py", globals())
27filename = "applications/" + APP + "/controllers/connectPC.py"
28
29exec(compile(open(filename, "rb").read(), filename, 'exec'), globals())
30
31
32
33
34class EventsTest(BaseTest):
35   
36    def testLoginEvent(self):                     
37        opengnsys.setServers(db)
38        opengnsys.setApiKey(opengnsys.doLogin(db, '2')['apikey'])
39
40        parametros_sesion_registrados = clients.register_session_parameters('2', '2', '6', '2')
41       
42        print(parametros_sesion_registrados)                       
43       
44        #self.assertRegex(message['output'], "Sending")
45        self.assertIsNotNone(parametros_sesion_registrados)
46       
47    def testLogoutEvent(self):                     
48        opengnsys.setServers(db)
49        opengnsys.setApiKey(opengnsys.doLogin(db, '2')['apikey'])
50
51        resultad0 = clients.unreserveRemotePC('2', '2', '6')
52       
53        print(resultad0)                       
54       
55        #self.assertRegex(message['output'], "Sending")
56        self.assertIsNotNone(resultad0)
57       
58
59           
60suite = unittest.TestSuite()
61suite.addTest(unittest.makeSuite(EventsTest))
62unittest.TextTestRunner(verbosity=2).run(suite)
Note: See TracBrowser for help on using the repository browser.