Example #1
0
def picopayments_server(request, server_db):

    # setup
    tempdir = tempfile.mkdtemp(prefix="picopayments_test_")
    basedir = os.path.join(tempdir, "basedir")
    shutil.copytree("tests/fixtures", basedir)

    srv.main([
        "--testnet",
        "--basedir={0}".format(basedir),
        "--cp_url={0}".format(config.RPC),
        "--cp_username={0}".format(config.RPC_USER),
        "--cp_password={0}".format(config.RPC_PASSWORD)
    ], serve=False)

    # monkeypatch sendrawtransaction to send tx and create new block
    def sendrawtransaction(tx_hex):
        validate.tx_signature(dispatcher, tx_hex)
        result = util_test.insert_raw_transaction(tx_hex, server_db)
        return result["tx_hash"]
    api.sendrawtransaction = sendrawtransaction

    def tear_down():
        shutil.rmtree(tempdir)

    request.addfinalizer(tear_down)
Example #2
0
 def setUp(self):
     self.tempdir = tempfile.mkdtemp(prefix="picopayments_test_")
     self.basedir = os.path.join(self.tempdir, "basedir")
     srv.main([
         "--testnet",
         "--basedir={0}".format(self.basedir),
         "--cp_url={0}".format(config.RPC)
     ], serve=False)
Example #3
0
 def test_version(self):
     version = srv.main([
         "--basedir={0}".format(self.basedir),
         "--version"
     ], serve=False)
     self.assertEqual(version, __version__)
Example #4
0
 def test_version(self):
     version = srv.main(["--basedir={0}".format(self.basedir), "--version"],
                        serve=False)
     self.assertEqual(version, __version__)