Tool to Update music players. I made this tool for the Test at TouchTunes interview. I don't Use a real API like it was demanded for the test. I do fake calls and responses from the API. I also made a small script called "fake_csv_generator.py" that can generate the input file for you if you do not have one.
- Having Python 3.10.10 or higher installed
- Having request-mock installed https://pypi.org/project/requests-mock/ :
pip install requests-mock
- Having you input the CSV file with the mac address of all the music player you want to be updated formatted like this: Or you can generate this input file by using this line:
py fake_csv_genretor.py
Run the command:
python PlayerUpdater.py [name of your csv input File]
Example:
python PlayerUpdater.py music_players.csv
The result you will see will be in this order
I decided to make it a simple command line tool so it can be used in the command line or called in other programs. I used request-mock to fake the call and response to the API. I decided that since this is a test, I don't need to handle the fact that the authentification token would expire in real life.
Because this is a simple tool, I did not feel there was any place in the code where it was worth doing unit tests
I have chosen to Use Python For 3 main reasons:
- Python can be used on Windows, MacOS and Linux as long you have it installed on your machine.
- I can use to fake API calls and responses in Python without having to code the actual API.
- It is a good language to do a simple command line tool like this one quickly.