Exemplo n.º 1
0
from .asset_template import Asset
from .bitcoin_address_format_checker import Checker
from .create_user import User
from bigchaindb_driver import BigchainDB
from settings import AppSettings
from hypothesis import given, settings, Verbosity, assume
from hypothesis.strategies import text

app_setting = AppSettings.get_settings()


def test_good_address():
    chk = Checker('1AMb4wcaZ7wZDLJ8frgjX9UZwcXs2mWRW8')
    assert chk.check_address() is True


def test_bad_checksum_address():
    chk = Checker('12Mb4wcaZ7wZDLJ8frgjX9UZwcXs2mWRW6')
    assert chk.check_address() is False


def test_short_address():
    chk = Checker('1AMb4wcaZ7wZDLJ8')
    assert chk.check_address() is False


def test_long_address():
    chk = Checker('12Mb4wcaZ7wZDLJ8frgjX9UZwcXs2mWRW61AMb4wcaZ7wZDLJ8frgjX9UZwcXs2mWRW8')
    assert chk.check_address() is False

Exemplo n.º 2
0
import sys
from flask import Flask
from flask_restful import Api, Resource, reqparse
from bigchaindb_driver import BigchainDB
from settings import AppSettings
# from flask_jwt import JWT, jwt_required, current_identity
# from werkzeug.security import safe_str_cmp

sys.path.append('./Asset_Handling/')
from Asset_Handling.exceptions import InvalidAliasException

app = Flask(__name__)
api = Api(app)
settings = AppSettings.get_settings()
# class ApiUser(object):
#
#     def __init__(self, asset):
#         self.id - asset.transaction_id
#         self.username = asset.username
#         self.password = asset.password

app.secret_key = settings['secret_key']


class Query(Resource):
    BDB = BigchainDB(settings['bigchainurl'])

    # TODO: add jwt auth to this
    # @jwt_required()
    def get(self):
        parser = reqparse.RequestParser()