Ejemplo n.º 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):
        util_test.insert_raw_transaction(tx_hex, server_db)
        return gettxid(tx_hex)
    api.sendrawtransaction = sendrawtransaction

    def tear_down():
        shutil.rmtree(tempdir)

    request.addfinalizer(tear_down)
Ejemplo n.º 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)
Ejemplo n.º 3
0
 def setUp(self):
     self.tempdir = tempfile.mkdtemp(prefix="picopayments_test_")
     self.basedir = os.path.join(self.tempdir, "basedir")
     shutil.copytree("tests/fixtures", self.basedir)
     srv.main([
         "--testnet",
         "--basedir={0}".format(self.basedir),
     ],
              serve=False)
Ejemplo n.º 4
0
 def setUp(self):
     self.tempdir = tempfile.mkdtemp(prefix="picopayments_test_")
     self.basedir = os.path.join(self.tempdir, "basedir")
     shutil.copytree("tests/fixtures", self.basedir)
     srv.main([
         "--testnet",
         "--basedir={0}".format(self.basedir),
         "--cp_url={0}".format(CP_URL)
     ], serve=False)
     with open(os.path.join(self.basedir, "data.json")) as fp:
         self.data = json.load(fp)
Ejemplo n.º 5
0
 def setUp(self):
     self.tempdir = tempfile.mkdtemp(prefix="picopayments_test_")
     self.basedir = os.path.join(self.tempdir, "basedir")
     shutil.copytree("tests/fixtures", self.basedir)
     srv.main([
         "--testnet", "--basedir={0}".format(self.basedir),
         "--cp_url={0}".format(CP_URL)
     ],
              serve=False)
     with open(os.path.join(self.basedir, "data.json")) as fp:
         self.data = json.load(fp)
Ejemplo n.º 6
0
 def test_funding_mainnet(self):
     addresses = srv.main(
         ["--basedir={0}".format(self.basedir), "--funding"], serve=False)
     self.assertIsNotNone(addresses)
     self.assertTrue(len(addresses) == 3)
     for address in addresses:
         validate.is_address_valid(address,
                                   allowable_netcodes=[etc.netcode])
Ejemplo n.º 7
0
 def test_version(self):
     version = srv.main(["--basedir={0}".format(self.basedir), "--version"],
                        serve=False)
     self.assertEqual(version, __version__)
Ejemplo n.º 8
0
 def test_terms_mainnet(self):
     terms = srv.main(["--basedir={0}".format(self.basedir), "--terms"],
                      serve=False)
     self.assertIsNotNone(terms)
     self.assertEqual(terms, lib.TERMS["MAINNET"])