/
instagram.users.coffee
148 lines (138 loc) · 7.6 KB
/
instagram.users.coffee
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
###
Test Setup
###
console.log "\nInstagram API Node.js Lib Tests :: Users"
Init = require './initialize'
Instagram = Init.Instagram
app = Init.app
assert = require 'assert'
should = require 'should'
test = require './helpers'
completed = 0
to_do = 0
###
Tests
###
module.exports =
'users#info for id#291024': ->
test.helper 'users#info for id#291024', Instagram, 'users', 'info', { user_id: 291024 }, (data) ->
data.should.have.property 'id', '291024'
test.output "data had the property 'id' equal to '291024'"
data.should.have.property 'profile_picture'
test.output "data had the property 'profile_picture'", data.profile_picture
app.finish_test()
'users#self for mckelvey': ->
test.helper 'users#self for mckelvey', Instagram, 'users', 'self', {}, (data) ->
data.length.should.be.above 0
test.output "data had length greater than 0", data.length
data[0].should.have.property 'id'
test.output "data[0] had the property 'id'", data[0].id
data[0].should.have.property 'user'
test.output "data[0] had the property 'user'", data[0].user
app.finish_test()
'users#liked_by_self for mckelvey': ->
test.helper 'users#liked_by_self for mckelvey', Instagram, 'users', 'liked_by_self', {}, (data) ->
data.length.should.be.above 0
test.output "data had length greater than 0", data.length
data[0].should.have.property 'id'
test.output "data[0] had the property 'id'", data[0].id
data[0].should.have.property 'user'
test.output "data[0] had the property 'user'", data[0].user
app.finish_test()
'users#liked_by_self for mckelvey with count of 3 and max_like_id': ->
test.helper 'users#liked_by_self for mckelvey with count of 3', Instagram, 'users', 'liked_by_self', { count: 3 }, (data, pagination) ->
data.length.should.equal 3
test.output "data had length equal to 3"
pagination.next_url.should.include.string('count=3')
test.output "pagination next_url included count of 3", pagination.next_url
pagination.should.have.property 'next_max_like_id'
test.output "pagination had the property 'next_max_like_id'", pagination.next_max_like_id
test.helper "users#liked_by_self for mckelvey with max_like_id of #{pagination.next_max_like_id}", Instagram, 'users', 'liked_by_self', { max_like_id: pagination.next_max_like_id }, (data, pagination) ->
data.length.should.be.above 0
test.output "data had length greater than 0", data.length
app.finish_test()
'users#recent for mckelvey': ->
test.helper 'users#recent for mckelvey', Instagram, 'users', 'recent', { user_id: 291024 }, (data) ->
data.length.should.be.above 0
data[0].should.have.property 'id'
data[0]['user'].should.have.property 'username', 'mckelvey'
app.finish_test()
'users#recent for mckelvey with count 60': ->
test.helper 'users#recent for mckelvey with count 60', Instagram, 'users', 'recent', { user_id: 291024, count: 60 }, (data) ->
data.length.should.equal 60
test.output "data had length equal to 60", data.length
app.finish_test()
'users#search for mckelvey': ->
test.helper 'users#search for mckelvey', Instagram, 'users', 'search', { q: 'mckelvey' }, (data) ->
data.length.should.be.above 0
test.output "data had length greater than 0", data.length
data[0].should.have.property 'username', 'mckelvey'
test.output "data had the property 'username' equal to 'mckelvey'"
data[0].should.have.property 'id', '291024'
test.output "data had the property 'id' equal to '291024'"
app.finish_test()
'users#search for i with count': ->
test.helper 'users#search for i with count', Instagram, 'users', 'search', { q: 'i', count: 50 }, (data) ->
data.length.should.equal 50
test.output "data had length equal to 50", data.length
app.finish_test()
'users#follows id#291024': ->
test.helper 'users#follows id#291024', Instagram, 'users', 'follows', { user_id: 291024 }, (data, pagination) ->
data.length.should.be.above 0
data.length.should.be.below 51
app.finish_test()
'users#follows id#291024 with count 50': ->
test.helper 'users#follows id#291024 with count 50', Instagram, 'users', 'follows', { user_id: 291024, count: 50 }, (data, pagination) ->
data.length.should.equal 50
test.output "data had length equal to 50", data.length
app.finish_test()
'users#followed_by id#291024': ->
test.helper 'users#followed_by id#291024', Instagram, 'users', 'followed_by', { user_id: 291024 }, (data, pagination) ->
data.length.should.be.above 0
test.output "data had length greater than 0"
data.length.should.be.below 51
test.output "data had length less than 51", data.length
app.finish_test()
'users#followed_by id#291024 with count 50': ->
test.helper 'users#followed_by id#291024 with count 50', Instagram, 'users', 'followed_by', { user_id: 291024, count: 50 }, (data, pagination) ->
data.length.should.equal 50
test.output "data had length equal to 50", data.length
app.finish_test()
'users#requested_by id#291024': ->
test.helper 'users#requested_by id#291024', Instagram, 'users', 'requested_by', { user_id: 291024 }, (data, pagination) ->
data.should.have.property 'length'
test.output "data had the property 'length'", data.length
app.finish_test()
'users#relationship with id#291024': ->
test.helper 'users#relationship with id#291024', Instagram, 'users', 'relationship', { user_id: 291024 }, (data, pagination) ->
data.should.have.property 'outgoing_status'
test.output "data had the property 'outgoing_status'", data.outgoing_status
data.should.have.property 'incoming_status'
test.output "data had the property 'incoming_status'", data.incoming_status
app.finish_test()
'users#unfollow id#291024': ->
test.helper 'users#unfollow id#291024', Instagram, 'users', 'unfollow', { user_id: 291024 }, (data, pagination) ->
data.should.have.property 'outgoing_status', 'none'
test.output "data had the property 'outgoing_status' equal to 'none'", data
test.helper 'users#block id#291024', Instagram, 'users', 'block', { user_id: 291024 }, (data, pagination) ->
data.should.have.property 'incoming_status', 'blocked_by_you'
test.output "data had the property 'incoming_status' equal to 'blocked_by_you'", data
test.helper 'users#unblock id#291024', Instagram, 'users', 'unblock', { user_id: 291024 }, (data, pagination) ->
data.should.have.property 'incoming_status', 'none'
test.output "data had the property 'incoming_status' equal to 'none'", data
test.helper 'users#ignore id#291024', Instagram, 'users', 'ignore', { user_id: 291024 }, (data, pagination) ->
data.should.have.property 'incoming_status', 'none'
test.output "data had the property 'incoming_status' equal to 'none'", data
test.helper 'users#follow id#291024', Instagram, 'users', 'follow', { user_id: 291024 }, (data, pagination) ->
data.should.have.property 'outgoing_status', 'follows'
test.output "data had the property 'outgoing_status' equal to 'follows'", data
app.finish_test()
###
for me, returns 9 regardless, requesting with count seems to have no impact Ñ time based only now?
'users#self for mckelvey with count 200': ->
test.helper 'users#self for mckelvey with count 200', Instagram, 'users', 'self', { count: 200 }, (data) ->
data.length.should.equal 200
test.output "data had length equal to 200", data.length
app.finish_test()
###
app.start_tests module.exports