vk_music 1.1.1 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +9 -7
- data/Rakefile +5 -0
- data/lib/vk_music.rb +3 -3
- data/lib/vk_music/audio.rb +143 -79
- data/lib/vk_music/client.rb +543 -250
- data/lib/vk_music/constants.rb +78 -33
- data/lib/vk_music/exceptions.rb +14 -17
- data/lib/vk_music/link_decoder.rb +9 -5
- data/lib/vk_music/playlist.rb +47 -36
- data/lib/vk_music/utility.rb +57 -19
- data/test/test_attached_audios_amount.rb +82 -0
- data/test/test_audios.rb +92 -0
- data/test/test_find.rb +43 -0
- data/test/test_from_id.rb +61 -0
- data/test/test_last_post_id.rb +46 -0
- data/test/test_login.rb +1 -1
- data/test/test_page_id.rb +113 -0
- data/test/test_playlist.rb +39 -10
- data/test/test_post.rb +21 -19
- data/test/test_wall.rb +56 -0
- data/vk_music.gemspec +4 -2
- metadata +31 -11
- data/test/test_audios_by_id.rb +0 -49
- data/test/test_get_id.rb +0 -113
- data/test/test_search.rb +0 -30
- data/test/test_user_or_group_audios.rb +0 -77
data/test/test_playlist.rb
CHANGED
@@ -11,47 +11,76 @@ end
|
|
11
11
|
class TestVkMusic < MiniTest::Test
|
12
12
|
|
13
13
|
def test_playlist_small
|
14
|
-
pl = CLIENT.
|
14
|
+
pl = CLIENT.playlist("https://vk.com/audio?z=audio_playlist-37661843_1/0e420c32c8b69e6637")
|
15
15
|
refute_empty(pl, "This playlist must not be empty")
|
16
16
|
assert_instance_of(VkMusic::Audio, pl[0], "Playlist members must be of class Audio")
|
17
17
|
refute_empty(pl[0].url, "Audio must have download url")
|
18
18
|
refute_empty(pl[-1].url, "Audio must have download url")
|
19
19
|
end
|
20
|
+
|
21
|
+
def test_playlist_small_with_options
|
22
|
+
pl = CLIENT.playlist(owner_id: -37661843, playlist_id: 1, access_hash: "0e420c32c8b69e6637", with_url: false)
|
23
|
+
refute_empty(pl, "This playlist must not be empty")
|
24
|
+
assert_instance_of(VkMusic::Audio, pl[0], "Playlist members must be of class Audio")
|
25
|
+
assert(pl[0].url_accessable?, "Audio must have all the data needed for getting download URL")
|
26
|
+
assert(pl[-1].url_accessable?, "Audio must have all the data needed for getting download URL")
|
27
|
+
end
|
20
28
|
|
21
29
|
def test_playlist_large
|
22
|
-
pl = CLIENT.
|
30
|
+
pl = CLIENT.playlist("https://vk.com/audio?z=audio_playlist121570739_7")
|
23
31
|
refute_empty(pl, "This playlist must not be empty")
|
24
32
|
refute_empty(pl[0].url, "Audio must have download url")
|
25
33
|
refute_empty(pl[-1].url, "Audio must have download url")
|
26
34
|
end
|
27
35
|
|
28
36
|
def test_playlist_empty
|
29
|
-
pl = CLIENT.
|
37
|
+
pl = CLIENT.playlist("https://vk.com/audios437727675?section=playlists&z=audio_playlist437727675_2")
|
30
38
|
assert_empty(pl, "This playlist must be empty")
|
31
39
|
end
|
32
40
|
|
33
41
|
def test_playlist_dont_exist
|
34
|
-
assert_raises(VkMusic::
|
35
|
-
CLIENT.
|
42
|
+
assert_raises(VkMusic::ParseError) do
|
43
|
+
CLIENT.playlist("https://m.vk.com/audio?act=audio_playlist437727675_300")
|
44
|
+
end
|
45
|
+
assert_raises(VkMusic::ParseError) do
|
46
|
+
CLIENT.playlist("https://m.vk.com/audio?act=audio_playlist437727675_300", with_url: false)
|
36
47
|
end
|
37
48
|
end
|
38
49
|
|
39
50
|
def test_playlist_no_access
|
40
|
-
assert_raises(VkMusic::
|
41
|
-
CLIENT.
|
51
|
+
assert_raises(VkMusic::ParseError) do
|
52
|
+
CLIENT.playlist("https://m.vk.com/audio?act=audio_playlist1_1")
|
53
|
+
end
|
54
|
+
assert_raises(VkMusic::ParseError) do
|
55
|
+
CLIENT.playlist("https://m.vk.com/audio?act=audio_playlist1_1", with_url: false)
|
42
56
|
end
|
43
57
|
end
|
44
58
|
|
45
59
|
def test_playlist_with_upper_limit
|
46
|
-
pl = CLIENT.
|
60
|
+
pl = CLIENT.playlist("https://vk.com/audio?z=audio_playlist121570739_7", up_to: 113)
|
47
61
|
assert_equal(113, pl.length, "Size of result must match given limit") # This playlist got more audios
|
48
62
|
refute_empty(pl[0].url, "Audio must have download url")
|
49
63
|
refute_empty(pl[-1].url, "Audio must have download url")
|
50
64
|
end
|
65
|
+
|
66
|
+
def test_playlist_without_url
|
67
|
+
pl = CLIENT.playlist("https://vk.com/audio?z=audio_playlist121570739_7", with_url: false)
|
68
|
+
assert(pl[0].url_accessable?, "Audio must have all the data needed for getting download URL")
|
69
|
+
assert(pl[-1].url_accessable?, "Audio must have all the data needed for getting download URL")
|
70
|
+
end
|
51
71
|
|
52
72
|
def test_bad_url
|
53
|
-
assert_raises(
|
54
|
-
CLIENT.
|
73
|
+
assert_raises(ArgumentError) do
|
74
|
+
CLIENT.playlist("ae")
|
75
|
+
end
|
76
|
+
assert_raises(ArgumentError) do
|
77
|
+
CLIENT.playlist("ae", with_url: false)
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
def test_bad_arg
|
82
|
+
assert_raises(ArgumentError) do
|
83
|
+
CLIENT.playlist("ae", "bc")
|
55
84
|
end
|
56
85
|
end
|
57
86
|
|
data/test/test_post.rb
CHANGED
@@ -11,7 +11,15 @@ end
|
|
11
11
|
class TestVkMusic < MiniTest::Test
|
12
12
|
|
13
13
|
def test_single_audio
|
14
|
-
audios = CLIENT.
|
14
|
+
audios = CLIENT.post("https://vk.com/wall-184089233_6")
|
15
|
+
assert_instance_of(Array, audios, "Result must be of class Array")
|
16
|
+
assert_equal(1, audios.length, "This post got 1 attached audio")
|
17
|
+
assert_instance_of(VkMusic::Audio, audios[0], "Array must consist of class Audio")
|
18
|
+
refute_empty(audios[0].url, "Audio must have download url")
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_single_audio_with_options
|
22
|
+
audios = CLIENT.post(owner_id: -184089233, post_id: 6)
|
15
23
|
assert_instance_of(Array, audios, "Result must be of class Array")
|
16
24
|
assert_equal(1, audios.length, "This post got 1 attached audio")
|
17
25
|
assert_instance_of(VkMusic::Audio, audios[0], "Array must consist of class Audio")
|
@@ -19,56 +27,50 @@ class TestVkMusic < MiniTest::Test
|
|
19
27
|
end
|
20
28
|
|
21
29
|
def test_no_audio
|
22
|
-
audios = CLIENT.
|
30
|
+
audios = CLIENT.post("https://vk.com/wall-184089233_2")
|
23
31
|
assert_empty(audios, "This post got no attached audio")
|
24
32
|
end
|
25
33
|
|
26
34
|
def test_url_to_reply
|
27
|
-
audios = CLIENT.
|
35
|
+
audios = CLIENT.post("https://m.vk.com/wall-4790861_10108")
|
28
36
|
assert_equal(1, audios.length, "Although this link redirects to comment, audios from post must be parsed")
|
29
37
|
end
|
30
38
|
|
31
39
|
def test_playlist
|
32
|
-
audios = CLIENT.
|
40
|
+
audios = CLIENT.post("vk.com/wall-184089233_4")
|
33
41
|
assert_empty(audios, "This post got attached playlist but those audios must not be parsed")
|
34
42
|
end
|
35
43
|
|
36
44
|
def test_comments_with_audios
|
37
|
-
audios = CLIENT.
|
45
|
+
audios = CLIENT.post("https://m.vk.com/wall-39786657_189247")
|
38
46
|
assert_equal(1, audios.length, "This post got comments with audios but those audios must not be parsed")
|
39
47
|
end
|
40
48
|
|
41
49
|
def test_repost_with_no_audios
|
42
|
-
audios = CLIENT.
|
50
|
+
audios = CLIENT.post("https://vk.com/wall-184936953_1")
|
43
51
|
assert_empty(audios, "This post got no attached audios")
|
44
52
|
end
|
45
53
|
|
46
54
|
def test_repost_with_audios
|
47
|
-
audios = CLIENT.
|
55
|
+
audios = CLIENT.post("https://vk.com/wall-184936953_2")
|
48
56
|
assert_equal(1, audios.length, "This repost got 1 attached audio")
|
49
57
|
refute_empty(audios[0].url, "Audio must have download url")
|
50
58
|
end
|
51
59
|
|
52
60
|
def test_repost_with_playlist
|
53
|
-
audios = CLIENT.
|
61
|
+
audios = CLIENT.post("https://vk.com/wall-184936953_3")
|
54
62
|
assert_empty(audios, "This post got no attached audios")
|
55
63
|
end
|
56
64
|
|
57
65
|
def test_bad_url
|
58
|
-
assert_raises(
|
59
|
-
CLIENT.
|
66
|
+
assert_raises(ArgumentError) do
|
67
|
+
CLIENT.post("ae")
|
60
68
|
end
|
61
69
|
end
|
62
70
|
|
63
|
-
def
|
64
|
-
assert_raises(VkMusic::
|
65
|
-
CLIENT.
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
def test_nonexistent_post_2
|
70
|
-
assert_raises(VkMusic::PostParseError) do
|
71
|
-
CLIENT.get_audios_from_post("https://m.vk.com/wall-4790861_-1")
|
71
|
+
def test_nonexistent_post
|
72
|
+
assert_raises(VkMusic::ParseError) do
|
73
|
+
CLIENT.post("https://m.vk.com/wall-4790861_1052600000")
|
72
74
|
end
|
73
75
|
end
|
74
76
|
|
data/test/test_wall.rb
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
require "minitest/autorun"
|
2
|
+
require_relative "../lib/vk_music.rb"
|
3
|
+
|
4
|
+
begin
|
5
|
+
CLIENT = VkMusic::Client.new(username: ARGV[0], password: ARGV[1])
|
6
|
+
rescue VkMusic::LoginError
|
7
|
+
puts "Unable to login! Please check provided credetionals"
|
8
|
+
exit
|
9
|
+
end
|
10
|
+
|
11
|
+
class TestVkMusic < MiniTest::Test
|
12
|
+
|
13
|
+
def test_url_1
|
14
|
+
arr = CLIENT.wall("https://vk.com/mashup", up_to: 10)
|
15
|
+
assert_instance_of(Array, arr, "Result must be an array")
|
16
|
+
refute_empty(arr, "There must be something on the wall")
|
17
|
+
assert_equal(10, arr.size, "Size must be exactly the given")
|
18
|
+
assert_instance_of(VkMusic::Audio, arr[0], "Playlist members must be of class Audio")
|
19
|
+
refute_empty(arr[0].url, "Audio must have download url")
|
20
|
+
refute_empty(arr[-1].url, "Audio must have download url")
|
21
|
+
end
|
22
|
+
|
23
|
+
def test_url_2
|
24
|
+
arr = CLIENT.wall("https://vk.com/mashup", with_url: false)
|
25
|
+
refute_empty(arr, "There must be something on the wall")
|
26
|
+
assert_instance_of(VkMusic::Audio, arr[0], "Playlist members must be of class Audio")
|
27
|
+
assert(arr[0].url_accessable?, "Audio must have accessable URL")
|
28
|
+
assert(arr[-1].url_accessable?, "Audio must have accessable URL")
|
29
|
+
end
|
30
|
+
|
31
|
+
def test_ids
|
32
|
+
arr = CLIENT.wall(owner_id: -39786657, post_id: 204102, with_url: false)
|
33
|
+
refute_empty(arr, "There must be something on the wall")
|
34
|
+
assert_instance_of(VkMusic::Audio, arr[0], "Playlist members must be of class Audio")
|
35
|
+
assert(arr[0].url_accessable?, "Audio must have accessable URL")
|
36
|
+
assert(arr[-1].url_accessable?, "Audio must have accessable URL")
|
37
|
+
end
|
38
|
+
|
39
|
+
def test_empty_wall
|
40
|
+
arr = CLIENT.wall("https://vk.com/club185224844")
|
41
|
+
assert_empty(arr, "This wall is empty")
|
42
|
+
end
|
43
|
+
|
44
|
+
def test_bad_url
|
45
|
+
assert_raises(VkMusic::ParseError) do
|
46
|
+
CLIENT.wall("abc")
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
def test_not_accessable_page
|
51
|
+
assert_raises(VkMusic::ParseError) do
|
52
|
+
CLIENT.wall("https://vk.com/club2")
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
data/vk_music.gemspec
CHANGED
@@ -2,7 +2,7 @@ Gem::Specification.new do |s|
|
|
2
2
|
s.name = "vk_music"
|
3
3
|
s.summary = "Provides interface to work with VK music via HTTP requests"
|
4
4
|
s.description = "Library to work with audios on popular Russian social network vk.com. VK disabled their public API for audios, so it is now necessary to use parsers instead."
|
5
|
-
s.version = "
|
5
|
+
s.version = "2.0.0"
|
6
6
|
s.author = "Kuznetsov Vladislav"
|
7
7
|
s.email = "fizvlad@mail.ru"
|
8
8
|
s.homepage = "https://github.com/fizvlad/vk-music-rb"
|
@@ -16,5 +16,7 @@ Gem::Specification.new do |s|
|
|
16
16
|
s.add_runtime_dependency "net-http-persistent", "2.9.4" # Required for mechanize. Future versions cause error.
|
17
17
|
s.add_runtime_dependency "execjs", "~>2.7"
|
18
18
|
s.add_runtime_dependency "json", "~>2.0"
|
19
|
-
|
19
|
+
|
20
|
+
s.add_development_dependency "rake", "~>12.3"
|
21
|
+
s.add_development_dependency "yard", "~>0.9"
|
20
22
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vk_music
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kuznetsov Vladislav
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-08-
|
11
|
+
date: 2019-08-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mechanize
|
@@ -73,13 +73,27 @@ dependencies:
|
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '12.3'
|
76
|
-
type: :
|
76
|
+
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '12.3'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: yard
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0.9'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0.9'
|
83
97
|
description: Library to work with audios on popular Russian social network vk.com.
|
84
98
|
VK disabled their public API for audios, so it is now necessary to use parsers instead.
|
85
99
|
email: fizvlad@mail.ru
|
@@ -98,13 +112,16 @@ files:
|
|
98
112
|
- lib/vk_music/link_decoder.rb
|
99
113
|
- lib/vk_music/playlist.rb
|
100
114
|
- lib/vk_music/utility.rb
|
101
|
-
- test/
|
102
|
-
- test/
|
115
|
+
- test/test_attached_audios_amount.rb
|
116
|
+
- test/test_audios.rb
|
117
|
+
- test/test_find.rb
|
118
|
+
- test/test_from_id.rb
|
119
|
+
- test/test_last_post_id.rb
|
103
120
|
- test/test_login.rb
|
121
|
+
- test/test_page_id.rb
|
104
122
|
- test/test_playlist.rb
|
105
123
|
- test/test_post.rb
|
106
|
-
- test/
|
107
|
-
- test/test_user_or_group_audios.rb
|
124
|
+
- test/test_wall.rb
|
108
125
|
- vk_music.gemspec
|
109
126
|
homepage: https://github.com/fizvlad/vk-music-rb
|
110
127
|
licenses:
|
@@ -130,10 +147,13 @@ signing_key:
|
|
130
147
|
specification_version: 4
|
131
148
|
summary: Provides interface to work with VK music via HTTP requests
|
132
149
|
test_files:
|
133
|
-
- test/
|
134
|
-
- test/
|
150
|
+
- test/test_attached_audios_amount.rb
|
151
|
+
- test/test_audios.rb
|
152
|
+
- test/test_find.rb
|
153
|
+
- test/test_from_id.rb
|
154
|
+
- test/test_last_post_id.rb
|
135
155
|
- test/test_login.rb
|
156
|
+
- test/test_page_id.rb
|
136
157
|
- test/test_playlist.rb
|
137
158
|
- test/test_post.rb
|
138
|
-
- test/
|
139
|
-
- test/test_user_or_group_audios.rb
|
159
|
+
- test/test_wall.rb
|
data/test/test_audios_by_id.rb
DELETED
@@ -1,49 +0,0 @@
|
|
1
|
-
require "minitest/autorun"
|
2
|
-
require_relative "../lib/vk_music.rb"
|
3
|
-
|
4
|
-
begin
|
5
|
-
CLIENT = VkMusic::Client.new(username: ARGV[0], password: ARGV[1])
|
6
|
-
rescue VkMusic::LoginError
|
7
|
-
puts "Unable to login! Please check provided credetionals"
|
8
|
-
exit
|
9
|
-
end
|
10
|
-
|
11
|
-
class TestVkMusic < MiniTest::Test
|
12
|
-
|
13
|
-
def test_one_id
|
14
|
-
results = CLIENT.get_audios_by_id("2000202604_456242434_32f6f3df29dc8e9c71_82fbafed15ef65709b")
|
15
|
-
refute_empty(results, "There must be some music")
|
16
|
-
assert_instance_of(Array, results, "Resultmust be an Array")
|
17
|
-
assert_instance_of(VkMusic::Audio, results[0], "Results of search must be of class Audio")
|
18
|
-
refute_empty(results[0].url, "Audio must have download url")
|
19
|
-
end
|
20
|
-
|
21
|
-
def test_two_id
|
22
|
-
results = CLIENT.get_audios_by_id("2000202604_456242434_32f6f3df29dc8e9c71_82fbafed15ef65709b",
|
23
|
-
["2000023175", "456242595", "addd832f78d7c61b6d", "b6b14f49280d4d55f0"])
|
24
|
-
assert_equal(2, results.size, "There must be 2 audios")
|
25
|
-
refute_empty(results[1].url, "Audio must have download url")
|
26
|
-
end
|
27
|
-
|
28
|
-
def test_bad_last
|
29
|
-
assert_raises(VkMusic::ReloadAudiosParseError) do
|
30
|
-
CLIENT.get_audios_by_id("2000202604_456242434_32f6f3df29dc8e9c71_82fbafed15ef65709b",
|
31
|
-
["42", "1337", "aaaa", "aaaaaa"])
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
def test_bad_first
|
36
|
-
assert_raises(VkMusic::ReloadAudiosParseError) do
|
37
|
-
CLIENT.get_audios_by_id(["42", "1337", "aaaa", "aaaaaa"],
|
38
|
-
"2000202604_456242434_32f6f3df29dc8e9c71_82fbafed15ef65709b")
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
def test_bad_all
|
43
|
-
assert_raises(VkMusic::ReloadAudiosParseError) do
|
44
|
-
CLIENT.get_audios_by_id(["42", "1337", "aaaa", "aaaaaa"],
|
45
|
-
"123_123_123_123")
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
end
|
data/test/test_get_id.rb
DELETED
@@ -1,113 +0,0 @@
|
|
1
|
-
require "minitest/autorun"
|
2
|
-
require_relative "../lib/vk_music.rb"
|
3
|
-
|
4
|
-
begin
|
5
|
-
CLIENT = VkMusic::Client.new(username: ARGV[0], password: ARGV[1])
|
6
|
-
rescue VkMusic::LoginError
|
7
|
-
puts "Unable to login! Please check provided credetionals"
|
8
|
-
exit
|
9
|
-
end
|
10
|
-
|
11
|
-
class TestVkMusic < MiniTest::Test
|
12
|
-
|
13
|
-
def test_user_link_with_id
|
14
|
-
id = CLIENT.get_id("https://vk.com/id51842614")
|
15
|
-
assert_equal("51842614", id, "Ids don't match")
|
16
|
-
end
|
17
|
-
|
18
|
-
def test_user_custom_link
|
19
|
-
id = CLIENT.get_id("https://vk.com/kopatych56")
|
20
|
-
assert_equal("51842614", id, "Ids don't match")
|
21
|
-
end
|
22
|
-
|
23
|
-
def test_user_custom
|
24
|
-
id = CLIENT.get_id("kopatych56")
|
25
|
-
assert_equal("51842614", id, "Ids don't match")
|
26
|
-
end
|
27
|
-
|
28
|
-
def test_user_id
|
29
|
-
id = CLIENT.get_id("51842614")
|
30
|
-
assert_equal("51842614", id, "Ids don't match")
|
31
|
-
end
|
32
|
-
|
33
|
-
def test_user_id_with_prefix
|
34
|
-
id = CLIENT.get_id("id51842614")
|
35
|
-
assert_equal("51842614", id, "Ids don't match")
|
36
|
-
end
|
37
|
-
|
38
|
-
def test_user_audios
|
39
|
-
id = CLIENT.get_id("https://vk.com/audios51842614")
|
40
|
-
assert_equal("51842614", id, "Ids don't match")
|
41
|
-
end
|
42
|
-
|
43
|
-
|
44
|
-
def test_group_link_with_id
|
45
|
-
id = CLIENT.get_id("https://vk.com/public39786657")
|
46
|
-
assert_equal("-39786657", id, "Ids don't match")
|
47
|
-
end
|
48
|
-
|
49
|
-
def test_group_custom_link
|
50
|
-
id = CLIENT.get_id("https://vk.com/mashup")
|
51
|
-
assert_equal("-39786657", id, "Ids don't match")
|
52
|
-
end
|
53
|
-
|
54
|
-
def test_group_custom
|
55
|
-
id = CLIENT.get_id("mashup")
|
56
|
-
assert_equal("-39786657", id, "Ids don't match")
|
57
|
-
end
|
58
|
-
|
59
|
-
def test_group_id
|
60
|
-
id = CLIENT.get_id("-39786657")
|
61
|
-
assert_equal("-39786657", id, "Ids don't match")
|
62
|
-
end
|
63
|
-
|
64
|
-
def test_group_id_with_prefix
|
65
|
-
id = CLIENT.get_id("public39786657")
|
66
|
-
assert_equal("-39786657", id, "Ids don't match")
|
67
|
-
end
|
68
|
-
|
69
|
-
def test_group_audios
|
70
|
-
id = CLIENT.get_id("https://vk.com/audios-39786657")
|
71
|
-
assert_equal("-39786657", id, "Ids don't match")
|
72
|
-
end
|
73
|
-
|
74
|
-
|
75
|
-
def test_user_deleted
|
76
|
-
id = CLIENT.get_id("https://vk.com/id245722576")
|
77
|
-
assert_equal("245722576", id, "Ids don't match")
|
78
|
-
end
|
79
|
-
|
80
|
-
def test_user_no_photos
|
81
|
-
id = CLIENT.get_id("drop_the_treble")
|
82
|
-
assert_equal("437727675", id, "Ids don't match")
|
83
|
-
end
|
84
|
-
|
85
|
-
def test_user_private
|
86
|
-
id = CLIENT.get_id("poppingeyesocketcherry") # I hope this guy won't change his custom
|
87
|
-
assert_equal("300415", id, "Ids don't match")
|
88
|
-
end
|
89
|
-
|
90
|
-
def test_group_no_photos
|
91
|
-
id = CLIENT.get_id("vk.com/opentestroom")
|
92
|
-
assert_equal("-184089233", id, "Ids don't match")
|
93
|
-
end
|
94
|
-
|
95
|
-
def test_bad_url
|
96
|
-
assert_raises(VkMusic::IdParseError) do
|
97
|
-
CLIENT.get_id("https://vk.com/feed")
|
98
|
-
end
|
99
|
-
end
|
100
|
-
|
101
|
-
def test_bad_custom
|
102
|
-
assert_raises(VkMusic::IdParseError) do
|
103
|
-
CLIENT.get_id("a")
|
104
|
-
end
|
105
|
-
end
|
106
|
-
|
107
|
-
def test_empty
|
108
|
-
assert_raises(VkMusic::IdParseError) do
|
109
|
-
CLIENT.get_id("")
|
110
|
-
end
|
111
|
-
end
|
112
|
-
|
113
|
-
end
|