'If the peer refuses to allow us to enable an option, the L{Deferred}
returned by L{TelnetProtocol.will} fires with an L{OptionRefused}
L{Failure}.'

def test_refusedEnableOffer(self):

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