Skip to content

Commit

Permalink
Improve test coverage in test_radio_browser.py
Browse files Browse the repository at this point in the history
  • Loading branch information
andreztz committed Nov 29, 2023
1 parent 4ead13c commit fe8c252
Show file tree
Hide file tree
Showing 9 changed files with 287 additions and 44 deletions.
1 change: 1 addition & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ pytest>=6.2.5
flake8>=4.0.1
responses>=0.15.0
setuptools
pytest-recording
38 changes: 38 additions & 0 deletions tests/cassettes/test_radio_browser/test_request_codecs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
interactions:
- request:
body: null
headers:
Accept:
- '*/*'
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
User-Agent:
- pyradios/2.0.0
method: GET
uri: https://nl1.api.radio-browser.info/json/codecs/
response:
body:
string: '[{"name":"AAC","stationcount":4449},{"name":"AAC+","stationcount":7495},{"name":"AAC+,H.264","stationcount":4},{"name":"AAC,H.264","stationcount":80},{"name":"FLV","stationcount":10},{"name":"MP3","stationcount":27967},{"name":"MP3,H.264","stationcount":14},{"name":"OGG","stationcount":443},{"name":"UNKNOWN","stationcount":1652}]'
headers:
Access-Control-Allow-Headers:
- origin, x-requested-with, content-type, User-Agent
Access-Control-Allow-Methods:
- GET,POST
Access-Control-Allow-Origin:
- '*'
Connection:
- keep-alive
Content-Length:
- '331'
Content-Type:
- application/json
Date:
- Wed, 25 Oct 2023 06:13:07 GMT
Server:
- nginx/1.18.0 (Ubuntu)
status:
code: 200
message: OK
version: 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
interactions:
- request:
body: null
headers:
Accept:
- '*/*'
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
User-Agent:
- pyradios/2.0.0
method: GET
uri: https://nl1.api.radio-browser.info/json/codecs/mp3
response:
body:
string: '[{"name":"MP3","stationcount":27967},{"name":"MP3,H.264","stationcount":14}]'
headers:
Access-Control-Allow-Headers:
- origin, x-requested-with, content-type, User-Agent
Access-Control-Allow-Methods:
- GET,POST
Access-Control-Allow-Origin:
- '*'
Connection:
- keep-alive
Content-Length:
- '76'
Content-Type:
- application/json
Date:
- Wed, 25 Oct 2023 06:13:08 GMT
Server:
- nginx/1.18.0 (Ubuntu)
status:
code: 200
message: OK
version: 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
interactions:
- request:
body: null
headers:
Accept:
- '*/*'
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
User-Agent:
- pyradios/2.0.0
method: GET
uri: https://nl1.api.radio-browser.info/json/countrycodes/BR
response:
body:
string: '[{"name":"BR","stationcount":953}]'
headers:
Access-Control-Allow-Headers:
- origin, x-requested-with, content-type, User-Agent
Access-Control-Allow-Methods:
- GET,POST
Access-Control-Allow-Origin:
- '*'
Connection:
- keep-alive
Content-Length:
- '34'
Content-Type:
- application/json
Date:
- Wed, 25 Oct 2023 06:13:07 GMT
Server:
- nginx/1.18.0 (Ubuntu)
status:
code: 200
message: OK
version: 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
interactions:
- request:
body: null
headers:
Accept:
- '*/*'
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
User-Agent:
- pyradios/2.0.0
method: GET
uri: https://nl1.api.radio-browser.info/json/languages/portuguese
response:
body:
string: '[{"name":"brazilian portuguese","iso_639":null,"stationcount":378},{"name":"portuguese","iso_639":"pt","stationcount":562}]'
headers:
Access-Control-Allow-Headers:
- origin, x-requested-with, content-type, User-Agent
Access-Control-Allow-Methods:
- GET,POST
Access-Control-Allow-Origin:
- '*'
Connection:
- keep-alive
Content-Length:
- '123'
Content-Type:
- application/json
Date:
- Wed, 25 Oct 2023 06:13:09 GMT
Server:
- nginx/1.18.0 (Ubuntu)
status:
code: 200
message: OK
version: 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
interactions:
- request:
body: null
headers:
Accept:
- '*/*'
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
User-Agent:
- pyradios/2.0.0
method: GET
uri: https://nl1.api.radio-browser.info/json/states/Brazil/Paran%C3%A1
response:
body:
string: "[{\"name\":\"Cascavel, Parana\",\"country\":\"Brazil\",\"stationcount\":1},{\"name\":\"Parana\",\"country\":\"Brazil\",\"stationcount\":16},{\"name\":\"Paran\xE1(Brazil)\",\"country\":\"Brazil\",\"stationcount\":13}]"
headers:
Access-Control-Allow-Headers:
- origin, x-requested-with, content-type, User-Agent
Access-Control-Allow-Methods:
- GET,POST
Access-Control-Allow-Origin:
- '*'
Connection:
- keep-alive
Content-Length:
- '184'
Content-Type:
- application/json
Date:
- Wed, 25 Oct 2023 06:13:09 GMT
Server:
- nginx/1.18.0 (Ubuntu)
status:
code: 200
message: OK
version: 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
interactions:
- request:
body: null
headers:
Accept:
- '*/*'
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
User-Agent:
- pyradios/2.0.0
method: GET
uri: https://nl1.api.radio-browser.info/json/stations/topvote/1
response:
body:
string: '[{"changeuuid":"8b62de9b-db82-43dd-9f8a-832a4346448e","stationuuid":"78012206-1aa1-11e9-a80b-52543be04c81","serveruuid":null,"name":"MANGORADIO","url":"http://stream.mangoradio.de/","url_resolved":"https://mangoradio.stream.laut.fm/mangoradio?t302=2023-10-25_06-42-39&uuid=f992e1d3-d33e-45de-978c-e56eb288f9ef","homepage":"https://mangoradio.de/","favicon":"","tags":"mango,mangoradio,mongo,mongoradio,public
radio,webradio","country":"Germany","countrycode":"DE","iso_3166_2":null,"state":"","language":"german","languagecodes":"de","votes":646087,"lastchangetime":"2022-10-02
08:26:04","lastchangetime_iso8601":"2022-10-02T08:26:04Z","codec":"MP3","bitrate":128,"hls":0,"lastcheckok":1,"lastchecktime":"2023-10-25
04:46:00","lastchecktime_iso8601":"2023-10-25T04:46:00Z","lastcheckoktime":"2023-10-25
04:46:00","lastcheckoktime_iso8601":"2023-10-25T04:46:00Z","lastlocalchecktime":"2023-10-25
03:44:01","lastlocalchecktime_iso8601":"2023-10-25T03:44:01Z","clicktimestamp":"2023-10-25
06:05:42","clicktimestamp_iso8601":"2023-10-25T06:05:42Z","clickcount":10851,"clicktrend":151,"ssl_error":0,"geo_lat":null,"geo_long":null,"has_extended_info":false}]'
headers:
Access-Control-Allow-Headers:
- origin, x-requested-with, content-type, User-Agent
Access-Control-Allow-Methods:
- GET,POST
Access-Control-Allow-Origin:
- '*'
Connection:
- keep-alive
Content-Length:
- '1152'
Content-Type:
- application/json
Date:
- Wed, 25 Oct 2023 06:13:11 GMT
Server:
- nginx/1.18.0 (Ubuntu)
status:
code: 200
message: OK
version: 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
interactions:
- request:
body: null
headers:
Accept:
- '*/*'
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
User-Agent:
- pyradios/2.0.0
method: GET
uri: https://nl1.api.radio-browser.info/json/tags/drum%20and%20bass
response:
body:
string: '[{"name":"drum and bass","stationcount":71}]'
headers:
Access-Control-Allow-Headers:
- origin, x-requested-with, content-type, User-Agent
Access-Control-Allow-Methods:
- GET,POST
Access-Control-Allow-Origin:
- '*'
Connection:
- keep-alive
Content-Length:
- '44'
Content-Type:
- application/json
Date:
- Wed, 25 Oct 2023 06:13:10 GMT
Server:
- nginx/1.18.0 (Ubuntu)
status:
code: 200
message: OK
version: 1
Loading

0 comments on commit fe8c252

Please sign in to comment.