def test_ok_remote_masters(mock_get_by_hostname): mock_get_by_hostname.return_value = ('myhost', [], ['1.2.3.4', '1.2.3.5']) ips, output = utils.calculate_remote_masters('myhost') assert output is None assert ips == ['1.2.3.4', '1.2.3.5']
def test_bad_calculate_remote_master(mock_get_by_hostname): mock_get_by_hostname.side_effect = gaierror('foo', 'bar') ips, output = utils.calculate_remote_masters('myhost') assert ips == [] assert 'ERROR while doing DNS lookup of paasta-myhost.yelp:\nbar\n' in output