teamlab 0.3.10 → 0.3.11

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,118 @@
1
+ require_relative '../spec_helper'
2
+
3
+ describe '[Settings]' do
4
+ before :all do
5
+ Teamlab.configure do |config|
6
+ config.server = SERVER
7
+ config.username = USERNAME
8
+ config.password = PASSWORD
9
+ end
10
+ end
11
+
12
+ let(:teamlab_module) { :settings }
13
+
14
+ describe '#add_user' do
15
+ it_should_behave_like 'an api request' do
16
+ let(:teamlab_module) { :people }
17
+ let(:command) { :add_user }
18
+ let(:args) { [false, random_email, random_word.capitalize, random_word.capitalize] }
19
+ let(:add_data_to_collector) { true }
20
+ let(:data_param) { :user_ids }
21
+ let(:param_names) { %w(id) }
22
+ end
23
+ end
24
+
25
+ describe '#get_settings' do
26
+ it_should_behave_like 'an api request' do
27
+ let(:command) { :get_settings }
28
+ end
29
+ end
30
+
31
+ describe '#get_sso_settings' do
32
+ it_should_behave_like 'an api request' do
33
+ let(:command) { :get_sso_settings }
34
+ end
35
+ end
36
+
37
+ describe '#get_ldap_settings' do
38
+ it_should_behave_like 'an api request', :pending do
39
+ pending 'only for self-hosted, error 500 when running on saas portal'
40
+ let(:command) { :get_ldap_settings }
41
+ end
42
+ end
43
+
44
+ describe '#get_logo' do
45
+ it_should_behave_like 'an api request' do
46
+ let(:command) { :get_logo }
47
+ end
48
+ end
49
+
50
+ describe '#get_usage_quota' do
51
+ it_should_behave_like 'an api request' do
52
+ let(:command) { :get_usage_quota }
53
+ end
54
+ end
55
+
56
+ describe '#get_version' do
57
+ it_should_behave_like 'an api request' do
58
+ let(:command) { :get_version }
59
+ end
60
+ end
61
+
62
+ describe '#get_white_label_sizes' do
63
+ it_should_behave_like 'an api request' do
64
+ let(:command) { :get_white_label_sizes }
65
+ end
66
+ end
67
+
68
+ describe '#get_security' do
69
+ it_should_behave_like 'an api request' do
70
+ let(:command) { :get_security }
71
+ let(:args) { [random_settings_entity_id] }
72
+ end
73
+ end
74
+
75
+ describe '#get_admin_security' do
76
+ it_should_behave_like 'an api request' do
77
+ let(:command) { :get_admin_security }
78
+ let(:args) { [random_settings_entity_id, random_id(:user)] }
79
+ end
80
+ end
81
+
82
+ describe '#get_product_admin' do
83
+ it_should_behave_like 'an api request' do
84
+ let(:command) { :get_product_admin }
85
+ let(:args) { [random_settings_entity_id] }
86
+ end
87
+ end
88
+
89
+ describe '#set_version' do
90
+ # TODO: You cannot change portal version to the same
91
+ it_behaves_like 'an api request', :pending do
92
+ let(:command) { :set_version }
93
+ let(:args) { [1] }
94
+ end
95
+ end
96
+
97
+ describe '#set_security' do
98
+ it_should_behave_like 'an api request' do
99
+ let(:command) { :set_security }
100
+ let(:args) { [random_settings_entity_id, {enabled: random_bool}] }
101
+ end
102
+ end
103
+
104
+ describe '#set_access' do
105
+ it_should_behave_like 'an api request', :pending do
106
+ pending 'http://bugzserver/show_bug.cgi?id=23764'
107
+ let(:command) { :set_access }
108
+ let(:args) { [[random_settings_entity_id, random_bool]] }
109
+ end
110
+ end
111
+
112
+ describe '#set_product_admin' do
113
+ it_should_behave_like 'an api request' do
114
+ let(:command) { :set_product_admin }
115
+ let(:args) { [random_settings_entity_id, random_id(:user)] }
116
+ end
117
+ end
118
+ end
data/spec/spec_helper.rb CHANGED
@@ -1,3 +1,38 @@
1
1
  require 'rspec'
2
- require 'support/http_data'
3
- require 'teamlab'
2
+ require_relative 'support/http_data'
3
+ require_relative '../lib/teamlab'
4
+
5
+ shared_examples_for 'an api request' do |*flags|
6
+ before { pending } if flags.include?(:pending)
7
+ before do
8
+ @module = Teamlab.send(teamlab_module)
9
+ puts "#{command}(#{args.join(', ')})"
10
+ @response = args.empty? ? @module.send(command) : @module.send(command, *args)
11
+ if add_data_to_collector
12
+ DATA_COLLECTOR[data_param] ||= []
13
+ response = [@response.body['response']].flatten
14
+ response.each do |cur_response|
15
+ DATA_COLLECTOR[data_param] << param_names.inject(cur_response) { |resp, param| resp[param] }
16
+ end
17
+ end
18
+ end
19
+
20
+ context 'Successful api request' do
21
+
22
+ it 'returns Teamlab::Response object' do
23
+ expect(@response).to be_instance_of(Teamlab::Response)
24
+ end
25
+
26
+ it 'returns Teamlab::Response object with successful parameter, set to true' do
27
+ expect(@response.success).to be_truthy
28
+ end
29
+
30
+ it 'returns Teamlab::Response object with nil error parameter' do
31
+ expect(@response.error).to be_nil
32
+ end
33
+
34
+ it 'returns Teamlab::Response object with hash body' do
35
+ expect(@response.body).to be_instance_of(Hash)
36
+ end
37
+ end
38
+ end
@@ -1,6 +1,6 @@
1
- SERVER = ''
2
- USERNAME = ''
3
- PASSWORD = ''
1
+ SERVER = 'https://nctautotest-rubygem-test.onlyoffice.com'
2
+ USERNAME = 'teamlab.ruby@gmail.com'
3
+ PASSWORD = '123456'
4
4
 
5
5
  DATA_COLLECTOR = {}
6
6
 
@@ -59,30 +59,7 @@ SETTINGS_FOR_TALK = { enabled: true }
59
59
  #region Files
60
60
  FILE_FOR_OPERATIONS_VERSION = 1
61
61
  FILES_SHARE_TYPES = %w(None ReadWrite Read Restrict)
62
- FILES_FOR_UPLOAD = %w(
63
- /mnt/data_share/Files/DOCX/AllDOCX/InternationalFoodCrisisAutosaved.docx
64
- /mnt/data_share/Files/DOCX/AllDOCX/dogs dont tell jokes bm.docx
65
- /mnt/data_share/Files/DOCX/AllDOCX/Demo-Hayden-Management.docx
66
- /mnt/data_share/Files/DOCX/AllDOCX/6 sınıf AAAAd.docx
67
- /mnt/data_share/Files/DOCX/AllDOCX/2010-2011 alparlan i.ö.o. 4.sınıf ingilizce 1.dönem.1yazılı sınzva.docx
68
- /mnt/data_share/Files/DOCX/AllDOCX/2.15.10TheEngagedUniversity.docx
69
- /mnt/data_share/Files/XLSX/AllXLSX/ICO_IMAGES.xlsx
70
- /mnt/data_share/Files/XLSX/AllXLSX/SmokeTopToolbar.xlsx
71
- /mnt/data_share/Files/XLSX/AllXLSX/Hasil TO GANAPATYA.xlsx
72
- /mnt/data_share/Files/XLSX/AllXLSX/FormulaDoc.xlsx
73
- /mnt/data_share/Files/XLSX/AllXLSX/EML_IMAGES.xlsx
74
- /mnt/data_share/Files/PPTX/AllPPTX/Abiturientu_tolimesnis_mokymasis_2010.pptx
75
- /mnt/data_share/Files/PPTX/AllPPTX/Disney Magic 5-D.pptx
76
- /mnt/data_share/Files/PPTX/AllPPTX/Kutatasok_a_kozteruleten.pptx
77
- /mnt/data_share/Files/PPTX/AllPPTX/oouchida_booster.pptx
78
- /mnt/data_share/Files/PPTX/AllPPTX/RR_Customer_Deck_FINAL_11.23.09.pptx
79
- /mnt/data_share/Files/PPTX/AllPPTX/SMB_Forms_ThruPartner.pptx
80
- /mnt/data_share/Files/JPG/2flash5.jpg
81
- /mnt/data_share/Files/JPG/3flash6-a.jpg
82
- /mnt/data_share/Files/JPG/141_014.jpg
83
- /mnt/data_share/Files/JPG/5350678_085.jpg
84
- /mnt/data_share/Files/JPG/animal39_animated_70x80_020.jpg
85
- )
62
+ FILE_FOR_UPLOAD = "#{File.dirname(__FILE__)}/../../spec/lib/data/docx_file.docx"
86
63
  #endregion
87
64
 
88
65
  #region Projects
@@ -116,5 +93,6 @@ EVENT_TYPES = %w(None News Order Advert AllNews Poll All)
116
93
  #region Calendar
117
94
  TIME_ZONES = %w(UTC)
118
95
  CALENDAR_TO_UPLOAD = '/mnt/data_share/Files/basic.ics'
96
+ CALENDAR_WEB_URL = 'https://raw.githubusercontent.com/onlyoffice-testing-robot/GemTeamlab/fix/make_test_working/spec/lib/data/basic.ics'
119
97
  #endregion
120
98
  #endregion
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: teamlab
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.10
4
+ version: 0.3.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - rzagudaev
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2015-07-22 00:00:00.000000000 Z
13
+ date: 2015-09-09 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: httparty
@@ -126,6 +126,17 @@ files:
126
126
  - lib/teamlab/Response.rb
127
127
  - lib/teamlab/version.rb
128
128
  - spec/lib/Teamlab_spec.rb
129
+ - spec/lib/calendar_spec.rb
130
+ - spec/lib/community_spec.rb
131
+ - spec/lib/crm_spec.rb
132
+ - spec/lib/data/basic.ics
133
+ - spec/lib/data/docx_file.docx
134
+ - spec/lib/files_spec.rb
135
+ - spec/lib/group_spec.rb
136
+ - spec/lib/mail_spec.rb
137
+ - spec/lib/people_spec.rb
138
+ - spec/lib/project_spec.rb
139
+ - spec/lib/settings_spec.rb
129
140
  - spec/spec_helper.rb
130
141
  - spec/support/http_data.rb
131
142
  - teamlab.gemspec
@@ -155,6 +166,17 @@ specification_version: 4
155
166
  summary: Ruby gem for OnlyOffice\TeamLab
156
167
  test_files:
157
168
  - spec/lib/Teamlab_spec.rb
169
+ - spec/lib/calendar_spec.rb
170
+ - spec/lib/community_spec.rb
171
+ - spec/lib/crm_spec.rb
172
+ - spec/lib/data/basic.ics
173
+ - spec/lib/data/docx_file.docx
174
+ - spec/lib/files_spec.rb
175
+ - spec/lib/group_spec.rb
176
+ - spec/lib/mail_spec.rb
177
+ - spec/lib/people_spec.rb
178
+ - spec/lib/project_spec.rb
179
+ - spec/lib/settings_spec.rb
158
180
  - spec/spec_helper.rb
159
181
  - spec/support/http_data.rb
160
182
  has_rdoc: