예제 #1
0
    def test_invalid_name(self):
        created = signal.create(self.btctxstore, self.wif, "test")

        # repack to eliminate namedtuples and simulate io
        repacked = umsgpack.unpackb(umsgpack.packb(created))

        self.assertIsNone(signal.read(self.btctxstore, repacked, "wrongname"))
예제 #2
0
    def test_invalid_token(self):
        created = base.create(self.btctxstore, self.wif, None, None)

        # repack to eliminate namedtuples and simulate io
        repacked = umsgpack.unpackb(umsgpack.packb(created))
        repacked[2] = "invalidtoken"

        self.assertIsNone(signal.read(self.btctxstore, self.nodeid, repacked))
예제 #3
0
    def test_create_read(self):

        # test create
        created = signal.create(self.btctxstore, self.wif, "test")

        # repack to eliminate namedtuples and simulate io
        repacked = umsgpack.unpackb(umsgpack.packb(created))

        # test read
        read = signal.read(self.btctxstore, repacked, "test")
        self.assertIsNotNone(read)
        self.assertEqual(created, read)
예제 #4
0
파일: info.py 프로젝트: bookchin/storjnode
 def __call__(self, node, source_id, msg):
     request = signal.read(node.server.btctxstore, msg, "request_info")
     if request is not None:
         _respond(node, request.sender, self.store_config)
예제 #5
0
파일: peers.py 프로젝트: bookchin/storjnode
 def handler(node, source_id, msg):
     request = signal.read(node.server.btctxstore, msg, "request_peers")
     if request is not None:
         peers = list(map(lambda n: n.id, node.get_neighbours()))
         msg = create(node.server.btctxstore, node.get_key(), peers)
         node.relay_message(request.sender, msg)