Ejemplo n.º 1
0
    def test_type_coercion(self):
        """
    The result is coerced to the proper type.

    https://github.com/iotaledger/iota.lib.py/issues/130
    """
        # noinspection SpellCheckingInspection
        self.adapter.seed_response(
            'getTips', {
                'duration':
                42,
                'hashes': [
                    'TESTVALUE9DONTUSEINPRODUCTION99999ANSVWB'
                    'CZ9ABZYUK9YYXFRLROGMCMQHRARDQPNMHHZSZ9999',
                    'TESTVALUE9DONTUSEINPRODUCTION99999HCZURL'
                    'NFWEDRFCYHWTYGUEMJLJ9ZIJTFASAVSEAZJGA9999',
                ],
            })

        gt_response = Iota(self.adapter).get_tips()

        self.assertEqual(
            list(map(type, gt_response['hashes'])),
            [TransactionHash] * 2,
        )
Ejemplo n.º 2
0
    def parse_argv(self, argv=None):
        # type: (Optional[tuple]) -> dict
        """
        Parses arguments for the command.

        :param argv:
            Arguments to pass to the argument parser.
            If ``None``, defaults to ``sys.argv[1:]``.
        """
        arguments = vars(self.create_argument_parser().parse_args(argv))

        seed = None
        if self.requires_seed:
            seed_filepath = arguments.pop('seed_file')

            seed = (self.seed_from_filepath(seed_filepath)
                    if seed_filepath else self.prompt_for_seed())

        arguments['api'] = Iota(
            adapter=arguments.pop('uri'),
            seed=seed,
            testnet=arguments.pop('testnet'),
        )

        return arguments
 def test_wireup(self):
   """
   Verify that the command is wired up correctly.
   """
   self.assertIsInstance(
     Iota(self.adapter).getLatestInclusion,
     GetLatestInclusionCommand,
   )
Ejemplo n.º 4
0
 def test_wireup(self):
     """
 Verify that the command is wired up correctly.
 """
     self.assertIsInstance(
         Iota(self.adapter).getNodeInfo,
         GetNodeInfoCommand,
     )
Ejemplo n.º 5
0
 def test_wireup(self):
     """
 Verify that the command is wired up correctly.
 """
     self.assertIsInstance(
         Iota(self.adapter).broadcastAndStore,
         BroadcastAndStoreCommand,
     )
Ejemplo n.º 6
0
 def test_wireup(self):
     """
 Verifies that the command is wired up correctly.
 """
     self.assertIsInstance(
         Iota(self.adapter).sendTransfer,
         SendTransferCommand,
     )
Ejemplo n.º 7
0
 def test_wireup(self):
     """
 Verify that the command is wired up correctly.
 """
     self.assertIsInstance(
         Iota(self.adapter).addNeighbors,
         AddNeighborsCommand,
     )
Ejemplo n.º 8
0
 def test_wireup(self):
   """
   Verifies that the command is wired up correctly.
   """
   self.assertIsInstance(
     Iota(self.adapter).getBundles,
     GetBundlesCommand,
   )
 def test_wireup(self):
   """
   Verify that the command is wired up correctly.
   """
   self.assertIsInstance(
     Iota(self.adapter).getTransactionsToApprove,
     GetTransactionsToApproveCommand,
   )
 def test_wireup(self):
     """
 Verify that the command is wired up correctly.
 """
     self.assertIsInstance(
         Iota(self.adapter).findTransactions,
         FindTransactionsCommand,
     )
Ejemplo n.º 11
0
 def test_wireup(self):
     """
 Verifies that the command is wired-up correctly.
 """
     self.assertIsInstance(
         Iota(self.adapter).promoteTransaction,
         PromoteTransactionCommand,
     )
 def test_wireup(self):
     """
 Verify that the command is wired up correctly.
 """
     self.assertIsInstance(
         Iota(self.adapter).getAccountData,
         GetAccountDataCommand,
     )
 def test_wireup(self):
   """
   Verify that the command is wired up correctly.
   """
   self.assertIsInstance(
     Iota(self.adapter).checkConsistency,
     CheckConsistencyCommand,
   )
Ejemplo n.º 14
0
 def test_wireup(self):
   """
   Verifies that the command is wired-up correctly.
   """
   self.assertIsInstance(
     Iota(self.adapter).replayBundle,
     ReplayBundleCommand,
   )
 def test_wireup(self):
     """
 Verify that the command is wired up correctly.
 """
     self.assertIsInstance(
         Iota(self.adapter).attachToTangle,
         AttachToTangleCommand,
     )
 def test_wireup(self):
     """
 Verify that the command is wired up correctly.
 """
     self.assertIsInstance(
         Iota(self.adapter).wereAddressesSpentFrom,
         WereAddressesSpentFromCommand,
     )
Ejemplo n.º 17
0
    def setUp(self):
        super(HelpersTestCase, self).setUp()

        self.api = api = Iota('mock://')
        self.api.adapter = MockAdapter()

        # noinspection SpellCheckingInspection
        self.transaction = ('TESTVALUE9DONTUSEINPRODUCTION99999KPZOTR'
                            'VDB9GZDJGZSSDCBIX9QOK9PAV9RMDBGDXLDTIZTWQ')