tests/test-sshserver.py
branchstable
changeset 51572 13c004b54cbe
parent 48946 642e31cb55f0
equal deleted inserted replaced
51571:74230abb2504 51572:13c004b54cbe
    23         for input, expected in tests:
    23         for input, expected in tests:
    24             self.assertparse(b'known', input, expected)
    24             self.assertparse(b'known', input, expected)
    25 
    25 
    26     def assertparse(self, cmd, input, expected):
    26     def assertparse(self, cmd, input, expected):
    27         server = mockserver(input)
    27         server = mockserver(input)
    28         proto = wireprotoserver.sshv1protocolhandler(
    28         ui = server._ui
    29             server._ui, server._fin, server._fout
    29         proto = wireprotoserver.sshv1protocolhandler(ui, ui.fin, ui.fout)
    30         )
       
    31         _func, spec = wireprotov1server.commands[cmd]
    30         _func, spec = wireprotov1server.commands[cmd]
    32         self.assertEqual(proto.getargs(spec), expected)
    31         self.assertEqual(proto.getargs(spec), expected)
    33 
    32 
    34 
    33 
    35 def mockserver(inbytes):
    34 def mockserver(inbytes):
    36     ui = mockui(inbytes)
    35     ui = mockui(inbytes)
    37     repo = mockrepo(ui)
    36     repo = mockrepo(ui)
       
    37     # note: this test unfortunately doesn't really test anything about
       
    38     # `sshserver` class anymore: the entirety of logic of that class lives
       
    39     # in `serveuntil`, and that function is not even called by this test.
    38     return wireprotoserver.sshserver(ui, repo)
    40     return wireprotoserver.sshserver(ui, repo)
    39 
    41 
    40 
    42 
    41 class mockrepo:
    43 class mockrepo:
    42     def __init__(self, ui):
    44     def __init__(self, ui):