Ticket #6220: conch-deprecate.patch

File conch-deprecate.patch, 25.6 KB (added by Julian Berman, 9 years ago)
  • twisted/conch/test/test_cftp.py

    diff --git a/twisted/conch/test/test_cftp.py b/twisted/conch/test/test_cftp.py
    index 03e327a..319feb7 100644
    a b class TestOurServerCmdLineClient(CFTPClientTestBase): 
    636636
    637637        d = self.runCommand('get testfile1 "%s/test file2"' % (self.testDir,))
    638638        d.addCallback(_checkGet)
    639         d.addCallback(lambda _: self.failIf(
     639        d.addCallback(lambda _: self.assertFalse(
    640640            os.path.exists(self.testDir + '/test file2')))
    641641        return d
    642642
    class TestOurServerCmdLineClient(CFTPClientTestBase): 
    668668        def _checkPut(result):
    669669            self.assertFilesEqual(self.testDir + '/testfile1',
    670670                                  self.testDir + '/test"file2')
    671             self.failUnless(result.endswith(expectedOutput))
     671            self.assertTrue(result.endswith(expectedOutput))
    672672            return self.runCommand('rm "test\\"file2"')
    673673
    674674        d = self.runCommand('put %s/testfile1 "test\\"file2"'
    675675                            % (self.testDir,))
    676676        d.addCallback(_checkPut)
    677         d.addCallback(lambda _: self.failIf(
     677        d.addCallback(lambda _: self.assertFalse(
    678678            os.path.exists(self.testDir + '/test"file2')))
    679679        return d
    680680
    exit 
    874874        def _cbCheckResult(res):
    875875            res = res.split('\n')
    876876            log.msg('RES %s' % str(res))
    877             self.failUnless(res[1].find(self.testDir) != -1, repr(res))
     877            self.assertTrue(res[1].find(self.testDir) != -1, repr(res))
    878878            self.assertEqual(res[3:-2], ['testDirectory', 'testRemoveFile',
    879879                                             'testRenameFile', 'testfile1'])
    880880
    pwd 
    890890exit
    891891"""
    892892        def _cbCheckResult(res):
    893             self.failIf(res.find(self.testDir) != -1)
     893            self.assertFalse(res.find(self.testDir) != -1)
    894894
    895895        d = self._getBatchOutput(cmds)
    896896        d.addCallback(_cbCheckResult)
    pwd 
    905905exit
    906906"""
    907907        def _cbCheckResult(res):
    908             self.failIf(res.find(self.testDir) == -1)
     908            self.assertFalse(res.find(self.testDir) == -1)
    909909
    910910        d = self._getBatchOutput(cmds)
    911911        d.addCallback(_cbCheckResult)
  • twisted/conch/test/test_checkers.py

    diff --git a/twisted/conch/test/test_checkers.py b/twisted/conch/test/test_checkers.py
    index 9c85050..a38abff 100644
    a b class HelperTests(TestCase): 
    105105        userdb.addUser(
    106106            'alice', 'secrit', 1, 2, 'first last', '/foo', '/bin/sh')
    107107        self.patch(checkers, 'pwd', userdb)
    108         self.assertEquals(
     108        self.assertEqual(
    109109            checkers._pwdGetByName('alice'), userdb.getpwnam('alice'))
    110110
    111111
    class HelperTests(TestCase): 
    131131        self.patch(checkers, 'os', self.mockos)
    132132        self.patch(util, 'os', self.mockos)
    133133
    134         self.assertEquals(
     134        self.assertEqual(
    135135            checkers._shadowGetByName('bob'), userdb.getspnam('bob'))
    136         self.assertEquals(self.mockos.seteuidCalls, [0, 2345])
    137         self.assertEquals(self.mockos.setegidCalls, [0, 1234])
     136        self.assertEqual(self.mockos.seteuidCalls, [0, 2345])
     137        self.assertEqual(self.mockos.setegidCalls, [0, 1234])
    138138
    139139
    140140    def test_shadowGetByNameWithoutSpwd(self):
    class HelperTests(TestCase): 
    153153        self.mockos.euid = 2345
    154154        self.mockos.egid = 1234
    155155
    156         self.assertEquals(
     156        self.assertEqual(
    157157            checkers._shadowGetByName('bob'), userdb.getspnam('bob'))
    158         self.assertEquals(self.mockos.seteuidCalls, [0, 2345])
    159         self.assertEquals(self.mockos.setegidCalls, [0, 1234])
     158        self.assertEqual(self.mockos.seteuidCalls, [0, 2345])
     159        self.assertEqual(self.mockos.setegidCalls, [0, 1234])
    160160
    161161
    162162    def test_shadowGetByNameWithoutEither(self):
    class HelperTests(TestCase): 
    169169        self.patch(checkers, 'os', self.mockos)
    170170
    171171        self.assertIdentical(checkers._shadowGetByName('bob'), None)
    172         self.assertEquals(self.mockos.seteuidCalls, [])
    173         self.assertEquals(self.mockos.setegidCalls, [])
     172        self.assertEqual(self.mockos.seteuidCalls, [])
     173        self.assertEqual(self.mockos.setegidCalls, [])
    174174
    175175
    176176
    class SSHProtocolCheckerTestCase(TestCase): 
    422422        """
    423423        The default L{SSHProcotolChecker.areDone} should simply return True.
    424424        """
    425         self.assertEquals(checkers.SSHProtocolChecker().areDone(None), True)
     425        self.assertEqual(checkers.SSHProtocolChecker().areDone(None), True)
    426426
    427427
    428428
    class UNIXPasswordDatabaseTests(TestCase): 
    446446        """
    447447        result = []
    448448        d.addBoth(result.append)
    449         self.assertEquals(len(result), 1, "login incomplete")
     449        self.assertEqual(len(result), 1, "login incomplete")
    450450        if isinstance(result[0], Failure):
    451451            result[0].raiseException()
    452         self.assertEquals(result[0], username)
     452        self.assertEqual(result[0], username)
    453453
    454454
    455455    def test_defaultCheckers(self):
    class UNIXPasswordDatabaseTests(TestCase): 
    486486
    487487        cred = UsernamePassword("alice", "password")
    488488        self.assertLoggedIn(checker.requestAvatarId(cred), 'alice')
    489         self.assertEquals(mockos.seteuidCalls, [])
    490         self.assertEquals(mockos.setegidCalls, [])
     489        self.assertEqual(mockos.seteuidCalls, [])
     490        self.assertEqual(mockos.setegidCalls, [])
    491491        cred.username = "bob"
    492492        self.assertLoggedIn(checker.requestAvatarId(cred), 'bob')
    493         self.assertEquals(mockos.seteuidCalls, [0, 2345])
    494         self.assertEquals(mockos.setegidCalls, [0, 1234])
     493        self.assertEqual(mockos.seteuidCalls, [0, 2345])
     494        self.assertEqual(mockos.setegidCalls, [0, 1234])
    495495
    496496
    497497    def assertUnauthorizedLogin(self, d):
  • twisted/conch/test/test_helper.py

    diff --git a/twisted/conch/test/test_helper.py b/twisted/conch/test/test_helper.py
    index 7064d03..5668cd9 100644
    a b class BufferTestCase(unittest.TestCase): 
    279279
    280280        ch = self.term.getCharacter(0, 0)
    281281        self.assertEqual(ch[0], 'W')
    282         self.failUnless(ch[1].bold)
    283         self.failUnless(ch[1].underline)
    284         self.failUnless(ch[1].blink)
    285         self.failUnless(ch[1].reverseVideo)
     282        self.assertTrue(ch[1].bold)
     283        self.assertTrue(ch[1].underline)
     284        self.assertTrue(ch[1].blink)
     285        self.assertTrue(ch[1].reverseVideo)
    286286
    287287        ch = self.term.getCharacter(1, 0)
    288288        self.assertEqual(ch[0], 'X')
    289         self.failIf(ch[1].bold)
    290         self.failIf(ch[1].underline)
    291         self.failIf(ch[1].blink)
    292         self.failIf(ch[1].reverseVideo)
     289        self.assertFalse(ch[1].bold)
     290        self.assertFalse(ch[1].underline)
     291        self.assertFalse(ch[1].blink)
     292        self.assertFalse(ch[1].reverseVideo)
    293293
    294294        ch = self.term.getCharacter(2, 0)
    295295        self.assertEqual(ch[0], 'Y')
    296         self.failUnless(ch[1].blink)
    297         self.failIf(ch[1].bold)
    298         self.failIf(ch[1].underline)
    299         self.failIf(ch[1].reverseVideo)
     296        self.assertTrue(ch[1].blink)
     297        self.assertFalse(ch[1].bold)
     298        self.assertFalse(ch[1].underline)
     299        self.assertFalse(ch[1].reverseVideo)
    300300
    301301        ch = self.term.getCharacter(3, 0)
    302302        self.assertEqual(ch[0], 'Z')
    303         self.failUnless(ch[1].blink)
    304         self.failUnless(ch[1].bold)
    305         self.failIf(ch[1].underline)
    306         self.failIf(ch[1].reverseVideo)
     303        self.assertTrue(ch[1].blink)
     304        self.assertTrue(ch[1].bold)
     305        self.assertFalse(ch[1].underline)
     306        self.assertFalse(ch[1].reverseVideo)
    307307
    308308    def testColorAttributes(self):
    309309        s1 = "Merry xmas"
    class ExpectTestCase(unittest.TestCase): 
    475475        d.addCallback(result.append)
    476476
    477477        self.term.write("greeting puny earthlings\n")
    478         self.failIf(result)
     478        self.assertFalse(result)
    479479        self.term.write("hello world\n")
    480         self.failUnless(result)
     480        self.assertTrue(result)
    481481        self.assertEqual(result[0].group(), "hello world")
    482482        self.assertEqual(len(self.fs.calls), 1)
    483         self.failIf(self.fs.calls[0].active())
     483        self.assertFalse(self.fs.calls[0].active())
    484484
    485485    def testBrokenUpString(self):
    486486        result = []
    487487        d = self.term.expect("hello world")
    488488        d.addCallback(result.append)
    489489
    490         self.failIf(result)
     490        self.assertFalse(result)
    491491        self.term.write("hello ")
    492         self.failIf(result)
     492        self.assertFalse(result)
    493493        self.term.write("worl")
    494         self.failIf(result)
     494        self.assertFalse(result)
    495495        self.term.write("d")
    496         self.failUnless(result)
     496        self.assertTrue(result)
    497497        self.assertEqual(result[0].group(), "hello world")
    498498
    499499
    class ExpectTestCase(unittest.TestCase): 
    504504        d2 = self.term.expect("world")
    505505        d2.addCallback(result.append)
    506506
    507         self.failIf(result)
     507        self.assertFalse(result)
    508508        self.term.write("hello")
    509         self.failIf(result)
     509        self.assertFalse(result)
    510510        self.term.write(" ")
    511511        self.assertEqual(len(result), 1)
    512512        self.term.write("world")
    class ExpectTestCase(unittest.TestCase): 
    520520        result = []
    521521        d = self.term.expect("hello world")
    522522        d.addCallback(result.append)
    523         self.failUnless(result)
     523        self.assertTrue(result)
    524524        self.assertEqual(result[0].group(), "hello world")
    525525
    526526    def testMultipleSynchronous(self):
    class ExpectTestCase(unittest.TestCase): 
    537537        self.assertEqual(result[1].group(), "world")
    538538
    539539    def _cbTestTimeoutFailure(self, res):
    540         self.assert_(hasattr(res, 'type'))
     540        self.assertTrue(hasattr(res, 'type'))
    541541        self.assertEqual(res.type, helper.ExpectationTimeout)
    542542
    543543    def testTimeoutFailure(self):
  • twisted/conch/test/test_insults.py

    diff --git a/twisted/conch/test/test_insults.py b/twisted/conch/test/test_insults.py
    index f313b5e..a794ade 100644
    a b class ServerArrowKeys(ByteGroupingsMixin, unittest.TestCase): 
    112112                      parser.RIGHT_ARROW, parser.LEFT_ARROW):
    113113            result = self.assertCall(occurrences(proto).pop(0), "keystrokeReceived", (arrow, None))
    114114            self.assertEqual(occurrences(result), [])
    115         self.failIf(occurrences(proto))
     115        self.assertFalse(occurrences(proto))
    116116
    117117
    118118class PrintableCharacters(ByteGroupingsMixin, unittest.TestCase):
    class PrintableCharacters(ByteGroupingsMixin, unittest.TestCase): 
    135135            self.assertEqual(occurrences(result), [])
    136136
    137137        occs = occurrences(proto)
    138         self.failIf(occs, "%r should have been []" % (occs,))
     138        self.assertFalse(occs, "%r should have been []" % (occs,))
    139139
    140140class ServerFunctionKeys(ByteGroupingsMixin, unittest.TestCase):
    141141    """Test for parsing and dispatching function keys (F1 - F12)
    class ServerFunctionKeys(ByteGroupingsMixin, unittest.TestCase): 
    156156            funcArg = getattr(parser, 'F%d' % (funcNum,))
    157157            result = self.assertCall(occurrences(proto).pop(0), "keystrokeReceived", (funcArg, None))
    158158            self.assertEqual(occurrences(result), [])
    159         self.failIf(occurrences(proto))
     159        self.assertFalse(occurrences(proto))
    160160
    161161class ClientCursorMovement(ByteGroupingsMixin, unittest.TestCase):
    162162    protocolFactory = ClientProtocol
    class ClientCursorMovement(ByteGroupingsMixin, unittest.TestCase): 
    176176                                ('Backward', 2), ('Up', 1), ('Backward', 2)]:
    177177            result = self.assertCall(occurrences(proto).pop(0), "cursor" + method, (count,))
    178178            self.assertEqual(occurrences(result), [])
    179         self.failIf(occurrences(proto))
     179        self.assertFalse(occurrences(proto))
    180180
    181181class ClientControlSequences(unittest.TestCase, MockMixin):
    182182    def setUp(self):
    class ClientControlSequences(unittest.TestCase, MockMixin): 
    186186        self.parser.factory = self
    187187        self.parser.makeConnection(self.transport)
    188188        result = self.assertCall(occurrences(self.proto).pop(0), "makeConnection", (self.parser,))
    189         self.failIf(occurrences(result))
     189        self.assertFalse(occurrences(result))
    190190
    191191    def testSimpleCardinals(self):
    192192        self.parser.dataReceived(
    class ClientControlSequences(unittest.TestCase, MockMixin): 
    196196        for meth in ("Down", "Up", "Forward", "Backward"):
    197197            for count in (1, 2, 20, 200):
    198198                result = self.assertCall(occs.pop(0), "cursor" + meth, (count,))
    199                 self.failIf(occurrences(result))
    200         self.failIf(occs)
     199                self.assertFalse(occurrences(result))
     200        self.assertFalse(occs)
    201201
    202202    def testScrollRegion(self):
    203203        self.parser.dataReceived('\x1b[5;22r\x1b[r')
    204204        occs = occurrences(self.proto)
    205205
    206206        result = self.assertCall(occs.pop(0), "setScrollRegion", (5, 22))
    207         self.failIf(occurrences(result))
     207        self.assertFalse(occurrences(result))
    208208
    209209        result = self.assertCall(occs.pop(0), "setScrollRegion", (None, None))
    210         self.failIf(occurrences(result))
    211         self.failIf(occs)
     210        self.assertFalse(occurrences(result))
     211        self.assertFalse(occs)
    212212
    213213    def testHeightAndWidth(self):
    214214        self.parser.dataReceived("\x1b#3\x1b#4\x1b#5\x1b#6")
    215215        occs = occurrences(self.proto)
    216216
    217217        result = self.assertCall(occs.pop(0), "doubleHeightLine", (True,))
    218         self.failIf(occurrences(result))
     218        self.assertFalse(occurrences(result))
    219219
    220220        result = self.assertCall(occs.pop(0), "doubleHeightLine", (False,))
    221         self.failIf(occurrences(result))
     221        self.assertFalse(occurrences(result))
    222222
    223223        result = self.assertCall(occs.pop(0), "singleWidthLine")
    224         self.failIf(occurrences(result))
     224        self.assertFalse(occurrences(result))
    225225
    226226        result = self.assertCall(occs.pop(0), "doubleWidthLine")
    227         self.failIf(occurrences(result))
    228         self.failIf(occs)
     227        self.assertFalse(occurrences(result))
     228        self.assertFalse(occs)
    229229
    230230    def testCharacterSet(self):
    231231        self.parser.dataReceived(
    class ClientControlSequences(unittest.TestCase, MockMixin): 
    235235        for which in (G0, G1):
    236236            for charset in (CS_UK, CS_US, CS_DRAWING, CS_ALTERNATE, CS_ALTERNATE_SPECIAL):
    237237                result = self.assertCall(occs.pop(0), "selectCharacterSet", (charset, which))
    238                 self.failIf(occurrences(result))
    239         self.failIf(occs)
     238                self.assertFalse(occurrences(result))
     239        self.assertFalse(occs)
    240240
    241241    def testShifting(self):
    242242        self.parser.dataReceived("\x15\x14")
    243243        occs = occurrences(self.proto)
    244244
    245245        result = self.assertCall(occs.pop(0), "shiftIn")
    246         self.failIf(occurrences(result))
     246        self.assertFalse(occurrences(result))
    247247
    248248        result = self.assertCall(occs.pop(0), "shiftOut")
    249         self.failIf(occurrences(result))
    250         self.failIf(occs)
     249        self.assertFalse(occurrences(result))
     250        self.assertFalse(occs)
    251251
    252252    def testSingleShifts(self):
    253253        self.parser.dataReceived("\x1bN\x1bO")
    254254        occs = occurrences(self.proto)
    255255
    256256        result = self.assertCall(occs.pop(0), "singleShift2")
    257         self.failIf(occurrences(result))
     257        self.assertFalse(occurrences(result))
    258258
    259259        result = self.assertCall(occs.pop(0), "singleShift3")
    260         self.failIf(occurrences(result))
    261         self.failIf(occs)
     260        self.assertFalse(occurrences(result))
     261        self.assertFalse(occs)
    262262
    263263    def testKeypadMode(self):
    264264        self.parser.dataReceived("\x1b=\x1b>")
    265265        occs = occurrences(self.proto)
    266266
    267267        result = self.assertCall(occs.pop(0), "applicationKeypadMode")
    268         self.failIf(occurrences(result))
     268        self.assertFalse(occurrences(result))
    269269
    270270        result = self.assertCall(occs.pop(0), "numericKeypadMode")
    271         self.failIf(occurrences(result))
    272         self.failIf(occs)
     271        self.assertFalse(occurrences(result))
     272        self.assertFalse(occs)
    273273
    274274    def testCursor(self):
    275275        self.parser.dataReceived("\x1b7\x1b8")
    276276        occs = occurrences(self.proto)
    277277
    278278        result = self.assertCall(occs.pop(0), "saveCursor")
    279         self.failIf(occurrences(result))
     279        self.assertFalse(occurrences(result))
    280280
    281281        result = self.assertCall(occs.pop(0), "restoreCursor")
    282         self.failIf(occurrences(result))
    283         self.failIf(occs)
     282        self.assertFalse(occurrences(result))
     283        self.assertFalse(occs)
    284284
    285285    def testReset(self):
    286286        self.parser.dataReceived("\x1bc")
    287287        occs = occurrences(self.proto)
    288288
    289289        result = self.assertCall(occs.pop(0), "reset")
    290         self.failIf(occurrences(result))
    291         self.failIf(occs)
     290        self.assertFalse(occurrences(result))
     291        self.assertFalse(occs)
    292292
    293293    def testIndex(self):
    294294        self.parser.dataReceived("\x1bD\x1bM\x1bE")
    295295        occs = occurrences(self.proto)
    296296
    297297        result = self.assertCall(occs.pop(0), "index")
    298         self.failIf(occurrences(result))
     298        self.assertFalse(occurrences(result))
    299299
    300300        result = self.assertCall(occs.pop(0), "reverseIndex")
    301         self.failIf(occurrences(result))
     301        self.assertFalse(occurrences(result))
    302302
    303303        result = self.assertCall(occs.pop(0), "nextLine")
    304         self.failIf(occurrences(result))
    305         self.failIf(occs)
     304        self.assertFalse(occurrences(result))
     305        self.assertFalse(occs)
    306306
    307307    def testModes(self):
    308308        self.parser.dataReceived(
    class ClientControlSequences(unittest.TestCase, MockMixin): 
    312312        occs = occurrences(self.proto)
    313313
    314314        result = self.assertCall(occs.pop(0), "setModes", ([modes.KAM, modes.IRM, modes.LNM],))
    315         self.failIf(occurrences(result))
     315        self.assertFalse(occurrences(result))
    316316
    317317        result = self.assertCall(occs.pop(0), "resetModes", ([modes.KAM, modes.IRM, modes.LNM],))
    318         self.failIf(occurrences(result))
    319         self.failIf(occs)
     318        self.assertFalse(occurrences(result))
     319        self.assertFalse(occs)
    320320
    321321    def testErasure(self):
    322322        self.parser.dataReceived(
    class ClientControlSequences(unittest.TestCase, MockMixin): 
    327327                     "eraseToDisplayEnd", "eraseToDisplayBeginning",
    328328                     "eraseDisplay"):
    329329            result = self.assertCall(occs.pop(0), meth)
    330             self.failIf(occurrences(result))
     330            self.assertFalse(occurrences(result))
    331331
    332332        result = self.assertCall(occs.pop(0), "deleteCharacter", (3,))
    333         self.failIf(occurrences(result))
    334         self.failIf(occs)
     333        self.assertFalse(occurrences(result))
     334        self.assertFalse(occs)
    335335
    336336    def testLineDeletion(self):
    337337        self.parser.dataReceived("\x1b[M\x1b[3M")
    class ClientControlSequences(unittest.TestCase, MockMixin): 
    339339
    340340        for arg in (1, 3):
    341341            result = self.assertCall(occs.pop(0), "deleteLine", (arg,))
    342             self.failIf(occurrences(result))
    343         self.failIf(occs)
     342            self.assertFalse(occurrences(result))
     343        self.assertFalse(occs)
    344344
    345345    def testLineInsertion(self):
    346346        self.parser.dataReceived("\x1b[L\x1b[3L")
    class ClientControlSequences(unittest.TestCase, MockMixin): 
    348348
    349349        for arg in (1, 3):
    350350            result = self.assertCall(occs.pop(0), "insertLine", (arg,))
    351             self.failIf(occurrences(result))
    352         self.failIf(occs)
     351            self.assertFalse(occurrences(result))
     352        self.assertFalse(occs)
    353353
    354354    def testCursorPosition(self):
    355355        methods(self.proto)['reportCursorPosition'] = (6, 7)
  • twisted/conch/test/test_mixin.py

    diff --git a/twisted/conch/test/test_mixin.py b/twisted/conch/test/test_mixin.py
    index 74d60ea..592aa48 100644
    a b class BufferingTest(unittest.TestCase): 
    2929        p = TestBufferingProto()
    3030        t = p.transport = StringTransport()
    3131
    32         self.failIf(p.scheduled)
     32        self.assertFalse(p.scheduled)
    3333
    3434        L = ['foo', 'bar', 'baz', 'quux']
    3535
    3636        p.write('foo')
    37         self.failUnless(p.scheduled)
    38         self.failIf(p.rescheduled)
     37        self.assertTrue(p.scheduled)
     38        self.assertFalse(p.rescheduled)
    3939
    4040        for s in L:
    4141            n = p.rescheduled
  • twisted/conch/test/test_ssh.py

    diff --git a/twisted/conch/test/test_ssh.py b/twisted/conch/test/test_ssh.py
    index 6cf1a1a..e25d224 100644
    a b class TestSSHFactory(unittest.TestCase): 
    866866        f2 = self.makeSSHFactory(primes={1:(2,3)})
    867867        p1 = f1.buildProtocol(None)
    868868        p2 = f2.buildProtocol(None)
    869         self.failIf('diffie-hellman-group-exchange-sha1' in p1.supportedKeyExchanges,
     869        self.assertFalse('diffie-hellman-group-exchange-sha1' in p1.supportedKeyExchanges,
    870870                p1.supportedKeyExchanges)
    871         self.failUnless('diffie-hellman-group-exchange-sha1' in p2.supportedKeyExchanges,
     871        self.assertTrue('diffie-hellman-group-exchange-sha1' in p2.supportedKeyExchanges,
    872872                p2.supportedKeyExchanges)
    873873
    874874
  • twisted/conch/test/test_transport.py

    diff --git a/twisted/conch/test/test_transport.py b/twisted/conch/test/test_transport.py
    index 8b801b0..baa1778 100644
    a b here's some other stuff 
    10621062        proto2 = MockTransportBase()
    10631063        proto2.makeConnection(proto_helpers.StringTransport())
    10641064        proto2.sendIgnore('')
    1065         self.failIfEquals(proto.gotVersion, proto2.gotVersion)
    1066         self.failIfEquals(proto.transport, proto2.transport)
    1067         self.failIfEquals(proto.outgoingPacketSequence,
     1065        self.assertNotEqual(proto.gotVersion, proto2.gotVersion)
     1066        self.assertNotEqual(proto.transport, proto2.transport)
     1067        self.assertNotEqual(proto.outgoingPacketSequence,
    10681068                          proto2.outgoingPacketSequence)
    1069         self.failIfEquals(proto.incomingPacketSequence,
     1069        self.assertNotEqual(proto.incomingPacketSequence,
    10701070                          proto2.incomingPacketSequence)
    1071         self.failIfEquals(proto.currentEncryptions,
     1071        self.assertNotEqual(proto.currentEncryptions,
    10721072                          proto2.currentEncryptions)
    1073         self.failIfEquals(proto.service, proto2.service)
     1073        self.assertNotEqual(proto.service, proto2.service)
    10741074
    10751075
    10761076
    class ServerSSHTransportTestCase(ServerAndClientSSHTransportBaseCase, 
    14811481        self.proto.outgoingCompressionType = 'zlib'
    14821482        self.simulateKeyExchange('AB', 'CD')
    14831483        self.proto.ssh_NEWKEYS('')
    1484         self.failIfIdentical(self.proto.outgoingCompression, None)
     1484        self.assertIsNot(self.proto.outgoingCompression, None)
    14851485        self.proto.incomingCompressionType = 'zlib'
    14861486        self.simulateKeyExchange('AB', 'EF')
    14871487        self.proto.ssh_NEWKEYS('')
    1488         self.failIfIdentical(self.proto.incomingCompression, None)
     1488        self.assertIsNot(self.proto.incomingCompression, None)
    14891489
    14901490
    14911491    def test_SERVICE_REQUEST(self):
    class ClientSSHTransportTestCase(ServerAndClientSSHTransportBaseCase, 
    17511751        self.proto.outgoingCompressionType = 'zlib'
    17521752        self.simulateKeyExchange('AB', 'GH')
    17531753        self.proto.ssh_NEWKEYS('')
    1754         self.failIfIdentical(self.proto.outgoingCompression, None)
     1754        self.assertIsNot(self.proto.outgoingCompression, None)
    17551755        self.proto.incomingCompressionType = 'zlib'
    17561756        self.simulateKeyExchange('AB', 'IJ')
    17571757        self.proto.ssh_NEWKEYS('')
    1758         self.failIfIdentical(self.proto.incomingCompression, None)
     1758        self.assertIsNot(self.proto.incomingCompression, None)
    17591759
    17601760
    17611761    def test_SERVICE_ACCEPT(self):
    class ClientSSHTransportTestCase(ServerAndClientSSHTransportBaseCase, 
    18211821        self.proto.instance = MockService()
    18221822        self.proto.ssh_SERVICE_ACCEPT('') # no payload
    18231823        self.assertTrue(self.proto.instance.started)
    1824         self.assertEquals(len(self.packets), 0) # not disconnected
     1824        self.assertEqual(len(self.packets), 0) # not disconnected
    18251825
    18261826
    18271827
    class SSHCiphersTestCase(unittest.TestCase): 
    18981898            enc = cip.encrypt(key[:bs])
    18991899            enc2 = cip.encrypt(key[:bs])
    19001900            if counter:
    1901                 self.failIfEquals(enc, enc2)
     1901                self.assertNotEqual(enc, enc2)
    19021902            self.assertEqual(encCipher.encrypt(key[:bs]), enc)
    19031903            self.assertEqual(encCipher.encrypt(key[:bs]), enc2)
    19041904            self.assertEqual(decCipher.decrypt(enc), key[:bs])
  • twisted/conch/test/test_userauth.py

    diff --git a/twisted/conch/test/test_userauth.py b/twisted/conch/test/test_userauth.py
    index d027faa..1b3ec41 100644
    a b class SSHUserAuthServerTestCase(unittest.TestCase): 
    552552        clearAuthServer.transport.isEncrypted = lambda x: False
    553553        clearAuthServer.serviceStarted()
    554554        clearAuthServer.serviceStopped()
    555         self.failIfIn('password', clearAuthServer.supportedAuthentications)
     555        self.assertNotIn('password', clearAuthServer.supportedAuthentications)
    556556        # only encrypt incoming (the direction the password is sent)
    557557        halfAuthServer = userauth.SSHUserAuthServer()
    558558        halfAuthServer.transport = FakeTransport(self.portal)
    class SSHUserAuthServerTestCase(unittest.TestCase): 
    575575        clearAuthServer.transport.isEncrypted = lambda x: False
    576576        clearAuthServer.serviceStarted()
    577577        clearAuthServer.serviceStopped()
    578         self.failIfIn('keyboard-interactive',
     578        self.assertNotIn('keyboard-interactive',
    579579                clearAuthServer.supportedAuthentications)
    580580        # only encrypt incoming (the direction the password is sent)
    581581        halfAuthServer = userauth.SSHUserAuthServer()