def update_bitcoin_interchain_v1(name: str) -> Tuple[str, int, Dict[str, str]]: if not flask.request.is_json: raise exceptions.BadRequest("Could not parse JSON") data = flask.request.json try: _validate_bitcoin_network_update_v1(data) except fastjsonschema.JsonSchemaException as e: raise exceptions.ValidationException(str(e)) return helpers.flask_http_response( 200, interchain.update_bitcoin_interchain_v1(name, data))
def test_update_interchain_bitcoin_calls_correctly(self, mock_get_interchain, mock_create_bitcoin): self.assertEqual( interchain.update_bitcoin_interchain_v1( "thing", {"rpc_address": "overwritten"}), "cool") mock_get_interchain.assert_called_once_with("bitcoin", "thing") mock_create_bitcoin.assert_called_once_with( { "version": "1", "name": "thing", "testnet": mock_get_interchain.return_value.testnet, "private_key": mock_get_interchain.return_value.get_private_key(), "rpc_address": "overwritten", "rpc_authorization": mock_get_interchain.return_value.authorization, "utxo_scan": False, }, conflict_check=False, )