Browse code

Rename variables to standar way

Blackbeard authored on 2018-09-10 18:51:50
Showing 2 changed files
... ...
@@ -3,6 +3,18 @@
3 3
 # This file is free software, go thank RMS
4 4
 ## PRAISE RMS, LORD AND SAVIOR
5 5
 
6
+#==============================
7
+#     DATA DEFINITIONS      #
8
+#==============================
9
+# TYPE_URL is one of:
10
+# albums  albums/file albums/tracks albums/musicinfo
11
+# playlists playlist/file playlists/tracks
12
+# FOR MORE LOOK AT /docs/api.txt
13
+
14
+# PARAMS documentation is on https://developer.jamendo.com/v3.0/read-methods
15
+
16
+
17
+
6 18
 #==============================
7 19
 #         BASIC URL          #
8 20
 #==============================
... ...
@@ -10,18 +22,44 @@
10 22
 # TYPE_URL PARAMS -> URL
11 23
 # Outputs a url string with type_of_url and parameters
12 24
 # this function won't check if type_url or params are valid
13
-function output_url_string {
14
-    local BASEURL="https://api.jamendo.com/v3.0/"
15
-    local Type_Url="$1"
16
-    local url_Type="$BASEURL$Type_Url"
25
+function _url_outputString {
26
+    local baseurl="https://api.jamendo.com/v3.0/"
27
+    local type_url="$1"
28
+    local url_type="$baseurl$type_url"
17 29
     
18
-    local CLIENTID="?client_id=73efbf98&"
19
-    local FORMAT="format=jsonpretty&"
20
-    local client_Format="$CLIENTID$FORMAT"
30
+    local clientid="?client_id=73efbf98&"
31
+    local format="format=jsonpretty&"
32
+    local client_format="$clientid$format"
21 33
 
22 34
     local params="$2"
23 35
 
24
-    echo "$url_Type$client_Format$params"
36
+    echo "$url_type$client_format$params"
25 37
 }
26 38
 
39
+#==============================
40
+#     PLAYLISTS URLS         #
41
+#==============================
27 42
 
43
+# PARAMS -> URL
44
+# Outputs a url for playlists with parameters
45
+# this function won't check if type_url or params are valid
46
+#### todo
47
+function url_playlists {
48
+    echo ""
49
+}
50
+   
51
+# PARAMS -> URL
52
+# Outputs a url for playlist tracks with parameters
53
+# this function won't check if type_url or params are valid
54
+#### todo
55
+function url_playlistsTracks {
56
+    echo ""
57
+}
58
+
59
+
60
+
61
+
62
+#### write
63
+function url_playlists {
64
+    echo ""
65
+}
... ...
@@ -1,24 +1,44 @@
1 1
 #! /bin/sh
2
-# file: examples/equality_test.sh
2
+# file: tests/backend/jamendo/urls-test.sh
3 3
 ## load mj-lib.sh
4 4
 
5
-########################################
6
-####       TEST INTERFACE          ####
7
-########################################
8 5
 
9 6
 #==============================
10
-#   TEST SIMPLE COMMANDS     #
7
+#         BASIC URL          #
11 8
 #==============================
12 9
 
13
-test_print_version() {
10
+
11
+test_url_outputString() {
12
+    local expected_string="https://api.jamendo.com/v3.0/playlists/tracks/?client_id=73efbf98&format=jsonpretty&id=500423230&"
13
+    
14
+    local function_string="$(_url_outputString "playlists/tracks/" "id=500423230&")"
15
+
16
+    assertEquals "$expected_string"  "$function_string"
17
+}
18
+
19
+
20
+test_url_playlists() {
14 21
     local expected_string="https://api.jamendo.com/v3.0/playlists/tracks/?client_id=73efbf98&format=jsonpretty&id=500423230&"
15 22
     
16
-    local function_string="$(output_url_string "playlists/tracks/" "id=500423230&")"
23
+    local function_string="$(_url_outputString "id=500423230&")"
17 24
 
18 25
     assertEquals "$expected_string"  "$function_string"
19 26
 }
20 27
 
21 28
 
29
+test_url_playlistsTracks() {
30
+    local expected_string="https://api.jamendo.com/v3.0/playlists/tracks/?client_id=73efbf98&format=jsonpretty&id=500423230&"
31
+    
32
+    local function_string="$(_url_outputString "id=500423230&")"
33
+
34
+    assertEquals "$expected_string"  "$function_string"
35
+}
36
+
37
+
38
+
39
+
40
+
41
+
22 42
 oneTimeSetUp() {
23 43
     # load my-jam.sh
24 44
 ##    . ../lib/lib.sh