Factor out common code in test_assembly

Change-Id: I2f2a051bf52d3f92010aa41f02172ac414f416ae