'If the peer refuses to enable an option we request it to enable, the
L{Deferred} returned by L{TelnetProtocol.do} fires with an
L{OptionRefused} L{Failure}.'

def test_refusedEnableRequest(self):

    self.p.protocol.remoteEnableable = ('B',)
    d = self.p.do('B')
    self.assertEqual(self.t.value(), ((telnet.IAC + telnet.DO) + 'B'))
    s = self.p.getOptionState('B')
    self.assertEqual(s.him.state, 'no')
    self.assertEqual(s.us.state, 'no')
    self.assertTrue(s.him.negotiating)
    self.assertFalse(s.us.negotiating)
    self.p.dataReceived(((telnet.IAC + telnet.WONT) + 'B'))
    d = self.assertFailure(d, telnet.OptionRefused)
    d.addCallback((lambda ignored: self._enabledHelper(self.p.protocol)))
    d.addCallback((lambda ignored: self.assertFalse(s.him.negotiating)))
    return d
