def testSpecifiedHost(self): one_passed = False try: server = program.WerkzeugServer( self._StubApplication(), self.make_flags(host="127.0.0.1", port=0, path_prefix=""), ) self.assertStartsWith(server.get_url(), "http://127.0.0.1:") one_passed = True except program.TensorBoardServerException: # IPv4 is not supported pass try: server = program.WerkzeugServer( self._StubApplication(), self.make_flags(host="::1", port=0, path_prefix=""), ) self.assertStartsWith(server.get_url(), "http://[::1]:") one_passed = True except program.TensorBoardServerException: # IPv6 is not supported pass self.assertTrue( one_passed ) # We expect either IPv4 or IPv6 to be supported
def testPathPrefixSlash(self): #Test that checks the path prefix ends with one trailing slash server = program.WerkzeugServer( self._StubApplication(), self.make_flags(port=0, path_prefix='/test')) self.assertEndsWith(server.get_url(), '/test/') server = program.WerkzeugServer( self._StubApplication(), self.make_flags(port=0, path_prefix='/test/')) self.assertEndsWith(server.get_url(), '/test/')
def testMakeServerBlankHost(self): # Test that we can bind to all interfaces without throwing an error server = program.WerkzeugServer( self._StubApplication(), self.make_flags(port=0, path_prefix="")) self.assertStartsWith(server.get_url(), "http://")