当前位置: 首页>>代码示例>>Python>>正文


Python TFTP.datagramReceived方法代码示例

本文整理汇总了Python中tftp.protocol.TFTP.datagramReceived方法的典型用法代码示例。如果您正苦于以下问题:Python TFTP.datagramReceived方法的具体用法?Python TFTP.datagramReceived怎么用?Python TFTP.datagramReceived使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在tftp.protocol.TFTP的用法示例。


在下文中一共展示了TFTP.datagramReceived方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_bad_mode

# 需要导入模块: from tftp.protocol import TFTP [as 别名]
# 或者: from tftp.protocol.TFTP import datagramReceived [as 别名]
 def test_bad_mode(self):
     tftp = TFTP(DummyBackend(), _clock=self.clock)
     tftp.transport = self.transport
     wrq_datagram = WRQDatagram('foobar', 'badmode', {})
     tftp.datagramReceived(wrq_datagram.to_wire(), ('127.0.0.1', 1111))
     error_datagram = TFTPDatagramFactory(*split_opcode(self.transport.value()))
     self.assertEqual(error_datagram.errorcode, ERR_ILLEGAL_OP)
开发者ID:deepakhajare,项目名称:maas,代码行数:9,代码来源:test_protocol.py

示例2: test_non_rq_datagram

# 需要导入模块: from tftp.protocol import TFTP [as 别名]
# 或者: from tftp.protocol.TFTP import datagramReceived [as 别名]
 def test_non_rq_datagram(self):
     tftp = TFTP(DummyBackend(), _clock=self.clock)
     tftp.transport = self.transport
     ack_datagram = ACKDatagram(14)
     tftp.datagramReceived(ack_datagram.to_wire(), ("127.0.0.1", 1111))
     self.failIf(self.transport.disconnecting)
     self.failIf(self.transport.value())
开发者ID:shylent,项目名称:python-tx-tftp,代码行数:9,代码来源:test_protocol.py

示例3: test_file_exists

# 需要导入模块: from tftp.protocol import TFTP [as 别名]
# 或者: from tftp.protocol.TFTP import datagramReceived [as 别名]
 def test_file_exists(self):
     tftp = TFTP(BackendFactory(FileExists("Already have one")), _clock=self.clock)
     tftp.transport = self.transport
     wrq_datagram = WRQDatagram('foobar', 'netascii', {})
     tftp.datagramReceived(wrq_datagram.to_wire(), ('127.0.0.1', 1111))
     error_datagram = TFTPDatagramFactory(*split_opcode(self.transport.value()))
     self.assertEqual(error_datagram.errorcode, ERR_FILE_EXISTS)
开发者ID:rvbad,项目名称:python-tx-tftp,代码行数:9,代码来源:test_protocol.py

示例4: test_file_not_found

# 需要导入模块: from tftp.protocol import TFTP [as 别名]
# 或者: from tftp.protocol.TFTP import datagramReceived [as 别名]
 def test_file_not_found(self):
     tftp = TFTP(BackendFactory(FileNotFound("Not found")), _clock=self.clock)
     tftp.transport = self.transport
     rrq_datagram = RRQDatagram('foobar', 'netascii', {})
     tftp.datagramReceived(rrq_datagram.to_wire(), ('127.0.0.1', 1111))
     error_datagram = TFTPDatagramFactory(*split_opcode(self.transport.value()))
     self.assertEqual(error_datagram.errorcode, ERR_FILE_NOT_FOUND)
开发者ID:rvbad,项目名称:python-tx-tftp,代码行数:9,代码来源:test_protocol.py

示例5: test_access_violation

# 需要导入模块: from tftp.protocol import TFTP [as 别名]
# 或者: from tftp.protocol.TFTP import datagramReceived [as 别名]
    def test_access_violation(self):
        tftp = TFTP(BackendFactory(AccessViolation("No!")), _clock=self.clock)
        tftp.transport = self.transport
        wrq_datagram = WRQDatagram('foobar', 'netascii', {})
        tftp.datagramReceived(wrq_datagram.to_wire(), ('127.0.0.1', 1111))
        error_datagram = TFTPDatagramFactory(*split_opcode(self.transport.value()))
        self.assertEqual(error_datagram.errorcode, ERR_ACCESS_VIOLATION)

        self.transport.clear()
        rrq_datagram = RRQDatagram('foobar', 'octet', {})
        tftp.datagramReceived(rrq_datagram.to_wire(), ('127.0.0.1', 1111))
        error_datagram = TFTPDatagramFactory(*split_opcode(self.transport.value()))
        self.assertEqual(error_datagram.errorcode, ERR_ACCESS_VIOLATION)
开发者ID:rvbad,项目名称:python-tx-tftp,代码行数:15,代码来源:test_protocol.py

示例6: test_unsupported

# 需要导入模块: from tftp.protocol import TFTP [as 别名]
# 或者: from tftp.protocol.TFTP import datagramReceived [as 别名]
    def test_unsupported(self):
        tftp = TFTP(BackendFactory(Unsupported("I don't support you")), _clock=self.clock)
        tftp.transport = self.transport
        wrq_datagram = WRQDatagram('foobar', 'netascii', {})
        tftp.datagramReceived(wrq_datagram.to_wire(), ('127.0.0.1', 1111))
        error_datagram = TFTPDatagramFactory(*split_opcode(self.transport.value()))
        self.assertEqual(error_datagram.errorcode, ERR_ILLEGAL_OP)

        self.transport.clear()
        rrq_datagram = RRQDatagram('foobar', 'octet', {})
        tftp.datagramReceived(rrq_datagram.to_wire(), ('127.0.0.1', 1111))
        error_datagram = TFTPDatagramFactory(*split_opcode(self.transport.value()))
        self.assertEqual(error_datagram.errorcode, ERR_ILLEGAL_OP)
开发者ID:rvbad,项目名称:python-tx-tftp,代码行数:15,代码来源:test_protocol.py

示例7: test_generic_backend_error

# 需要导入模块: from tftp.protocol import TFTP [as 别名]
# 或者: from tftp.protocol.TFTP import datagramReceived [as 别名]
    def test_generic_backend_error(self):
        tftp = TFTP(BackendFactory(BackendError("A backend that couldn't")), _clock=self.clock)
        tftp.transport = self.transport
        rrq_datagram = RRQDatagram('foobar', 'netascii', {})
        tftp.datagramReceived(rrq_datagram.to_wire(), ('127.0.0.1', 1111))
        error_datagram = TFTPDatagramFactory(*split_opcode(self.transport.value()))
        self.assertEqual(error_datagram.errorcode, ERR_NOT_DEFINED)

        self.transport.clear()
        rrq_datagram = RRQDatagram('foobar', 'octet', {})
        tftp.datagramReceived(rrq_datagram.to_wire(), ('127.0.0.1', 1111))
        error_datagram = TFTPDatagramFactory(*split_opcode(self.transport.value()))
        self.assertEqual(error_datagram.errorcode, ERR_NOT_DEFINED)
开发者ID:rvbad,项目名称:python-tx-tftp,代码行数:15,代码来源:test_protocol.py

示例8: test_malformed_datagram

# 需要导入模块: from tftp.protocol import TFTP [as 别名]
# 或者: from tftp.protocol.TFTP import datagramReceived [as 别名]
 def test_malformed_datagram(self):
     tftp = TFTP(BackendFactory(), _clock=self.clock)
     tftp.datagramReceived('foobar', ('127.0.0.1', 1111))
     self.failIf(self.transport.disconnecting)
     self.failIf(self.transport.value())
开发者ID:deepakhajare,项目名称:maas,代码行数:7,代码来源:test_protocol.py

示例9: test_malformed_datagram

# 需要导入模块: from tftp.protocol import TFTP [as 别名]
# 或者: from tftp.protocol.TFTP import datagramReceived [as 别名]
 def test_malformed_datagram(self):
     tftp = TFTP(BackendFactory(), _clock=self.clock)
     tftp.datagramReceived(b"foobar", ("127.0.0.1", 1111))
     self.assertFalse(self.transport.disconnecting)
     self.assertFalse(self.transport.value())
开发者ID:shylent,项目名称:python-tx-tftp,代码行数:7,代码来源:test_protocol.py

示例10: datagramReceived

# 需要导入模块: from tftp.protocol import TFTP [as 别名]
# 或者: from tftp.protocol.TFTP import datagramReceived [as 别名]
 def datagramReceived(self, *args, **kwargs):
     self.session = TFTP.datagramReceived(self, *args, **kwargs)
开发者ID:rvbad,项目名称:python-tx-tftp,代码行数:4,代码来源:test_protocol.py


注:本文中的tftp.protocol.TFTP.datagramReceived方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。