Testing a CLI
Now that we have successfully built the CLI application, we can do some testing to make sure that it’s working. We can test out the commands we’ve created and then write out proper tests to make sure any future changes don’t break the current functionality.
Manual testing
To upload an audio file, we’ll run the following command:
./audiofile-cli upload -filename audio/beatdoctor.mp3
The result is as expected:
Uploading audio/beatdoctor.mp3 ... Audiofile ID: 8a6a8942-161e-4b10-bf59-9d21785c9bd9
Now that we have the audiofile ID, we can immediately get the metadata, which will change as the metadata updates after each extraction process. The command for requesting metadata is as follows:
./audiofile-cli get -id=8a6a8942-161e-4b10-bf59- 9d21785c9bd9
The result is the populated Audio
struct in JSON format:
{ "Id": "8a6a8942-161e-4b10-bf59-9d21785c9bd9", ...