def setUp(self): app.config["SKIP_AUTHENTICATION"] = False # monkey patch self.app = app.test_client() self.btctxstore = BtcTxStore() db.create_all()
def setUp(self): app.config["SKIP_AUTHENTICATION"] = True # monkey patch app.config["DISABLE_CACHING"] = True self.btctxstore = BtcTxStore() self.bad_addr = 'notvalidaddress' self.app = app.test_client() db.create_all()
def setUp(self): app.config["SKIP_AUTHENTICATION"] = False # monkey patch self.app = app.test_client() db.create_all()
def setUp(self): app.config["SKIP_AUTHENTICATION"] = True # monkey patch app.config["DISABLE_CACHING"] = True self.app = app.test_client() db.create_all()
json_data = {'id': randint(0, 9999999), 'total_TB': round(result, 2)} return jsonify(json_data) @app.route('/api/height/<btc_addr>/<int:height>', methods=["GET"]) def set_height(btc_addr, height): # create Farmer object to represent user user = Farmer(btc_addr) user.authenticate(request.headers.get('Authorization'), request.headers.get('Date')) # attempt to set height try: user.set_height(height) return make_response("Height accepted.", 200) except ValueError: msg = "Invalid Bitcoin address." return make_response(msg, 400) except LookupError: msg = "Farmer not found." return make_response(msg, 404) if __name__ == '__main__': # pragma: no cover # Create Database db.create_all() # Run the Flask app app.run(host="0.0.0.0", port=int("5000"), debug=True)
result = total_shards * (app.config["BYTE_SIZE"] / (1024 * 1024 * 1024 * 1024)) # bytes / 1 TB json_data = {"id": randint(0, 9999999), "total_TB": round(result, 2)} return jsonify(json_data) @app.route("/api/height/<btc_addr>/<int:height>", methods=["GET"]) def set_height(btc_addr, height): # create Farmer object to represent user user = Farmer(btc_addr) user.authenticate(request.headers.get("Authorization"), request.headers.get("Date")) # attempt to set height try: user.set_height(height) return make_response("Height accepted.", 200) except ValueError: msg = "Invalid Bitcoin address." return make_response(msg, 400) except LookupError: msg = "Farmer not found." return make_response(msg, 404) if __name__ == "__main__": # pragma: no cover # Create Database db.create_all() # Run the Flask app app.run(host="0.0.0.0", port=int("5000"), debug=True)
def setUp(self): self.app = app.test_client() db.create_all()