Ejemplo n.º 1
0
    def test_resourceGET(self):
        """
        Test render_GET
        """

        loadsim = WebAdminTests.FakeLoadSim()
        resource = LoadSimAdminResource(loadsim)

        response = resource.render_GET(WebAdminTests.FakeRequest())
        self.assertTrue(response.startswith("<html>"))
        self.assertTrue(response.find(resource.token) != -1)
Ejemplo n.º 2
0
 def test_resourceGET(self):
     """
     Test render_GET
     """
     
     loadsim = WebAdminTests.FakeLoadSim()
     resource = LoadSimAdminResource(loadsim)
     
     response = resource.render_GET(WebAdminTests.FakeRequest())
     self.assertTrue(response.startswith("<html>"))
     self.assertTrue(response.find(resource.token) != -1)
Ejemplo n.º 3
0
 def test_resourcePOST_Stop_BadToken(self):
     """
     Test render_POST when Stop button is clicked but token is wrong
     """
     
     loadsim = WebAdminTests.FakeLoadSim()
     resource = LoadSimAdminResource(loadsim)
     self.assertTrue(loadsim.reactor.running)
    
     response = resource.render_POST(WebAdminTests.FakeRequest(
         token=("xyz",),
         stop=None,
     ))
     self.assertTrue(response.startswith("<html>"))
     self.assertTrue(response.find(resource.token) != -1)
     self.assertTrue(response.find("FakeReporter") == -1)
     self.assertTrue(loadsim.running)
Ejemplo n.º 4
0
 def test_resourcePOST_Results(self):
     """
     Test render_POST when Results button is clicked
     """
     
     loadsim = WebAdminTests.FakeLoadSim()
     resource = LoadSimAdminResource(loadsim)
     self.assertTrue(loadsim.reactor.running)
    
     response = resource.render_POST(WebAdminTests.FakeRequest(
         token=(resource.token,),
         results=None,
     ))
     self.assertTrue(response.startswith("<html>"))
     self.assertTrue(response.find(resource.token) != -1)
     self.assertTrue(response.find("FakeReporter") != -1)
     self.assertTrue(loadsim.running)
Ejemplo n.º 5
0
    def test_resourcePOST_Stop_BadToken(self):
        """
        Test render_POST when Stop button is clicked but token is wrong
        """

        loadsim = WebAdminTests.FakeLoadSim()
        resource = LoadSimAdminResource(loadsim)
        self.assertTrue(loadsim.reactor.running)

        response = resource.render_POST(WebAdminTests.FakeRequest(
            token=("xyz",),
            stop=None,
        ))
        self.assertTrue(response.startswith("<html>"))
        self.assertTrue(response.find(resource.token) != -1)
        self.assertTrue(response.find("FakeReporter") == -1)
        self.assertTrue(loadsim.running)
Ejemplo n.º 6
0
    def test_resourcePOST_Results(self):
        """
        Test render_POST when Results button is clicked
        """

        loadsim = WebAdminTests.FakeLoadSim()
        resource = LoadSimAdminResource(loadsim)
        self.assertTrue(loadsim.reactor.running)

        response = resource.render_POST(WebAdminTests.FakeRequest(
            token=(resource.token,),
            results=None,
        ))
        self.assertTrue(response.startswith("<html>"))
        self.assertTrue(response.find(resource.token) != -1)
        self.assertTrue(response.find("FakeReporter") != -1)
        self.assertTrue(loadsim.running)