We present a framework for quantifying the impact of fire sales in a network of financial institutions with common asset holdings, subject to leverage or capital constraints. Asset losses triggered by macro-shocks may interact with one-sided portfolio constraints, such as leverage or capital constraints, resulting in liquidation of assets, which in turn affects market prices, leading to contagion of losses and possibly new rounds of fire sales when portfolios are marked to market. Price-mediated contagion occurs through common asset holdings, which we quantify through liquidity-weighted overlaps across portfolios. Exposure to price-mediated contagion leads to the concept of indirect exposure to an asset class, as a consequence of which the risk of a portfolio depends on the matrix of asset holdings of other large and leveraged portfolios with similar assets. Our model provides an operational stress testing method for quantifying the systemic risk arising from these effects. Using data from the European Banking Authority, we examine the exposure of the EU banking system to price-mediated contagion. Our results indicate that, even with optimistic estimates of market depth, moderately large macro-shocks may trigger fire sales which may then lead to substantial losses across bank portfolios, modifying the outcome of bank stress tests. Price-mediated contagion leads to a heterogeneous cross-sectional loss distribution across banks, which cannot be replicated simply by applying a macro-shock to bank portfolios in absence of fire sales. Unlike models based on 'leverage targeting', which assume symmetric reactions to gains or losses, our approach is based on the asymmetric interaction of portfolio losses with one-sided constraints, distinguishes between insolvency and illiquidity and leads to substantially different loss estimates in stress scenarios.