As Denis observed in the comments above, for many countries, gold would have been traded through securities in the first half of the twentieth century. In those cases the physical transfer of the gold would indeed have been the exception, rather than the rule. That said, there would undoubtedly have been a great many cases where gold was transferred as payment, and some form of metallurgical assay to ensure its purity would have been required.
Apart from a few modern techniques like X-ray fluorescence (XRF), most of the techniques used to assay gold were in use long before the twentieth century. (In any event, XRF - although non-detructive - can be fooled by surface treatments like gold-plating). The most likely techniques, however, would be using a "touchstone" or conducting a "Fire Assay".
In the example you give, where the gold was to be exchanged for the goods at the port, testing would probably have been carried out with a touchstone. The use of touchstones dates back to antiquity, and they remain in use to this day. These could easily distinguish between, for example, 14 carat and 24 carat gold (I've done it myself), and I read that experienced testers can achieve accuracies of better than 5%.
If a more accurate assessment was required, a Fire Assay may have been carried out on a sample from one or more of the ingots. This technique is destructive, but has been available since the sixteenth century (a version is mentioned in Agricola's De Re Metallica). I would very much doubt that a Fire Assay could have been carried out at the port though (unless specialist facilities were available there expressly for that purpose).
[One of the reasons that national mints introduced mint-marks on bullion from about the eighteenth century was to assure its quality and so eliminate the need for such testing].
Today, a fire assay on gold can achieve an accuracy of better than 0.05%. My reading of the text of A Manual of Assaying, by Arthur Stanley Miller, seems to suggest that similar accuracies would have been achievable when it was published in 1905.