Exemple #1
0
    def test_should_respond_even_if_things_fail(self):
        class MockConnection(object):
            def __init__(self):
                pass

            def connect(self, server, timeout):
                raise Exception("something went wrong")

        response = ProjectLoader(ServerConfig('url', [], '', '', '', ''), 10, MockConnection()).get_data()
        projects = response.server.get_projects()
        self.assertEquals(0, len(projects))
        self.assertEquals(True, response.server.unavailable)
Exemple #2
0
 def test_should_set_display_prefix(self):
     connection = MockConnection(lambda: StringIO("""<?xml version="1.0" encoding="UTF-8"?>
                                     <Projects>
                                         <Project name="project" 
                                             activity="Sleeping" 
                                             lastBuildStatus="Success" 
                                             lastBuildTime="2009-06-12T06:54:35" 
                                             webUrl="http://local/url"/>
                                     </Projects>"""))
     response = ProjectLoader(ServerConfig('url', [], '', 'RELEASE', '', ''), 10, connection).get_data()
     projects = response.server.get_projects()
     self.assertEquals(1, len(projects))
     self.assertEquals("[RELEASE] project", projects[0].label())
Exemple #3
0
 def test_should_load_feed(self):
     connection = MockConnection(lambda: StringIO("""<?xml version="1.0" encoding="UTF-8"?>
                             <Projects>
                                 <Project name="project" 
                                     activity="Sleeping" 
                                     lastBuildStatus="Success" 
                                     lastBuildTime="2009-06-12T06:54:35" 
                                     webUrl="http://local/url"/>
                             </Projects>"""))
     response = ProjectLoader(ServerConfig('url', [], '', '', '', ''), 10, connection).get_data()
     projects = response.server.get_projects()
     self.assertEquals(1, len(projects))
     self.assertEquals("project", projects[0].name)
     self.assertEquals("Sleeping", projects[0].activity)
     self.assertEquals("Success", projects[0].status)
     self.assertEquals(False, response.server.unavailable)
 def load_projects(self) -> Response:
     config = self.get_server_config()
     self.project_loader = ProjectLoader(config, self.conf.timeout)
     return self.project_loader.get_data()
 def load_projects(self):
     self.project_loader = ProjectLoader(self.get_server_config(),
                                         self.conf.timeout)
     return self.project_loader.get_data()