prevent multiple devices with same external_identifier
move test code into its own package.