Example #1
0
    def test_get_bind_address(self):
        from rosgraph.network import get_bind_address
        assert '0.0.0.0' == get_bind_address('foo')
        assert '127.0.0.1' == get_bind_address('localhost')
        assert '127.0.1.1' == get_bind_address('127.0.1.1')

        # now test address override
        os.environ['ROS_IP'] = 'bar'
        assert '0.0.0.0' == get_bind_address()
        assert '0.0.0.0' == get_bind_address('foo')
        os.environ['ROS_IP'] = 'localhost'
        assert '127.0.0.1' == get_bind_address()
        assert '0.0.0.0' == get_bind_address('foo')
        os.environ['ROS_HOSTNAME'] = 'bar'
        assert '0.0.0.0' == get_bind_address()
        assert '0.0.0.0' == get_bind_address('foo')
        os.environ['ROS_HOSTNAME'] = 'localhost'
        assert '127.0.0.1' == get_bind_address()
        assert '0.0.0.0' == get_bind_address('foo')
 def test_get_bind_address(self):
     from rosgraph.network import get_bind_address
     assert '0.0.0.0' == get_bind_address('foo')
     assert '127.0.0.1' == get_bind_address('localhost')
     assert '127.0.0.1' == get_bind_address('127.0.1.1')
 
     # now test address override
     os.environ['ROS_IP'] = 'bar'
     assert '0.0.0.0' == get_bind_address()       
     assert '0.0.0.0' == get_bind_address('foo')
     os.environ['ROS_IP'] = 'localhost'
     assert '127.0.0.1' == get_bind_address()
     assert '0.0.0.0' == get_bind_address('foo')
     os.environ['ROS_HOSTNAME'] = 'bar'
     assert '0.0.0.0' == get_bind_address()
     assert '0.0.0.0' == get_bind_address('foo')
     os.environ['ROS_HOSTNAME'] = 'localhost'
     assert '127.0.0.1' == get_bind_address()  
     assert '0.0.0.0' == get_bind_address('foo')