auth0 4.4.0 → 4.5.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -15,10 +15,54 @@ describe Auth0::Api::V2::Connections do
15
15
  '/api/v2/connections',
16
16
  strategy: nil,
17
17
  fields: nil,
18
- include_fields: true
18
+ include_fields: nil,
19
+ page: nil,
20
+ per_page: nil
19
21
  )
20
22
  expect { @instance.connections }.not_to raise_error
21
23
  end
24
+
25
+ it 'is expected to send get request to /api/v2/connections?fields=name' do
26
+ expect(@instance).to receive(:get).with(
27
+ '/api/v2/connections',
28
+ include_fields: true,
29
+ fields: 'name',
30
+ strategy: nil,
31
+ page: nil,
32
+ per_page: nil
33
+ )
34
+ expect {
35
+ @instance.connections(fields: 'name', include_fields: true)
36
+ }.not_to raise_error
37
+ end
38
+
39
+ it 'is expected to convert fields param from Array to string' do
40
+ expect(@instance).to receive(:get).with(
41
+ '/api/v2/connections',
42
+ include_fields: true,
43
+ fields: 'name,strategy',
44
+ strategy: nil,
45
+ page: nil,
46
+ per_page: nil
47
+ )
48
+ expect {
49
+ @instance.connections(fields: ['name','strategy'], include_fields: true)
50
+ }.not_to raise_error
51
+ end
52
+
53
+ it 'is expected to add pagination' do
54
+ expect(@instance).to receive(:get).with(
55
+ '/api/v2/connections',
56
+ page: 1,
57
+ per_page: 10,
58
+ strategy: nil,
59
+ fields: nil,
60
+ include_fields: nil
61
+ )
62
+ expect {
63
+ @instance.connections(page: 1, per_page: 10)
64
+ }.not_to raise_error
65
+ end
22
66
  end
23
67
 
24
68
  context '.create_connection' do
@@ -9,12 +9,34 @@ describe Auth0::Api::V2::Rules do
9
9
 
10
10
  context '.rules' do
11
11
  it { expect(@instance).to respond_to(:rules) }
12
+
12
13
  it 'is expected to call get /api/v2/rules' do
13
14
  expect(@instance).to receive(:get).with(
14
- '/api/v2/rules', enabled: nil, fields: nil, include_fields: nil, stage: nil
15
+ '/api/v2/rules',
16
+ enabled: nil,
17
+ fields: nil,
18
+ include_fields: nil,
19
+ stage: nil,
20
+ page: nil,
21
+ per_page: nil
15
22
  )
16
23
  expect { @instance.rules }.not_to raise_error
17
24
  end
25
+
26
+ it 'is expected to call get /api/v2/rules with pagination' do
27
+ expect(@instance).to receive(:get).with(
28
+ '/api/v2/rules',
29
+ enabled: nil,
30
+ fields: nil,
31
+ include_fields: nil,
32
+ stage: nil,
33
+ page: 1,
34
+ per_page: 2
35
+ )
36
+ expect {
37
+ @instance.rules(page: 1, per_page: 2)
38
+ }.not_to raise_error
39
+ end
18
40
  end
19
41
 
20
42
  context '.rule' do
@@ -9,6 +9,7 @@ describe Auth0::Api::V2::Users do
9
9
  context '.users' do
10
10
  it { expect(@instance).to respond_to(:users) }
11
11
  it { expect(@instance).to respond_to(:get_users) }
12
+
12
13
  it 'is expected to call /api/v2/users' do
13
14
  expect(@instance).to receive(:get).with(
14
15
  '/api/v2/users',
@@ -19,10 +20,27 @@ describe Auth0::Api::V2::Users do
19
20
  connection: nil,
20
21
  fields: nil,
21
22
  include_fields: nil,
22
- q: nil
23
+ q: nil,
24
+ search_engine: nil
23
25
  )
24
26
  expect { @instance.users }.not_to raise_error
25
27
  end
28
+
29
+ it 'is expected to call /api/v2/users with a search engine' do
30
+ expect(@instance).to receive(:get).with(
31
+ '/api/v2/users',
32
+ per_page: nil,
33
+ page: nil,
34
+ include_totals: nil,
35
+ sort: nil,
36
+ connection: nil,
37
+ fields: nil,
38
+ include_fields: nil,
39
+ q: nil,
40
+ search_engine: 'v3'
41
+ )
42
+ expect { @instance.users(search_engine: 'v3') }.not_to raise_error
43
+ end
26
44
  end
27
45
 
28
46
  context '.user' do
@@ -17,7 +17,7 @@ Dir['./spec/support/**/*.rb'].each { |f| require f }
17
17
  Dir['./spec/support/*.rb'].each { |f| require f }
18
18
 
19
19
  def entity_suffix
20
- (ENV['TRAVIS_JOB_ID'] || 'local').delete('_')
20
+ (ENV['TRAVIS_JOB_ID'] || ENV['TEST_ENTITY_SUFFIX'] || 'rubytest').delete('_')
21
21
  end
22
22
 
23
23
  puts "Entity suffix is #{entity_suffix}"
@@ -26,8 +26,7 @@ RSpec.configure do |config|
26
26
  v2_client.delete_client(client['client_id'])
27
27
  }
28
28
  v2_client
29
- .users
30
- .select { |user| user['email'].split('@').first.include? entity_suffix }
29
+ .users(q: "email:#{entity_suffix}*", fields: 'user_id', page: 0, per_page: 50)
31
30
  .each { |user|
32
31
  sleep 1
33
32
  v2_client.delete_user(user['user_id'])
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: auth0
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.4.0
4
+ version: 4.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Auth0
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2018-02-19 00:00:00.000000000 Z
14
+ date: 2018-07-27 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rest-client
@@ -413,8 +413,54 @@ required_rubygems_version: !ruby/object:Gem::Requirement
413
413
  version: '0'
414
414
  requirements: []
415
415
  rubyforge_project: auth0
416
- rubygems_version: 2.7.5
416
+ rubygems_version: 2.7.7
417
417
  signing_key:
418
418
  specification_version: 4
419
419
  summary: Auth0 API Client
420
- test_files: []
420
+ test_files:
421
+ - spec/integration/lib/auth0/api/api_authentication_spec.rb
422
+ - spec/integration/lib/auth0/api/v2/api_blacklist_spec.rb
423
+ - spec/integration/lib/auth0/api/v2/api_client_grants_spec.rb
424
+ - spec/integration/lib/auth0/api/v2/api_clients_spec.rb
425
+ - spec/integration/lib/auth0/api/v2/api_connections_spec.rb
426
+ - spec/integration/lib/auth0/api/v2/api_device_credentials_spec.rb
427
+ - spec/integration/lib/auth0/api/v2/api_email_spec.rb
428
+ - spec/integration/lib/auth0/api/v2/api_jobs_spec.rb
429
+ - spec/integration/lib/auth0/api/v2/api_logs_spec.rb
430
+ - spec/integration/lib/auth0/api/v2/api_resource_servers_spec.rb
431
+ - spec/integration/lib/auth0/api/v2/api_rules_spec.rb
432
+ - spec/integration/lib/auth0/api/v2/api_stats_spec.rb
433
+ - spec/integration/lib/auth0/api/v2/api_tenants_spec.rb
434
+ - spec/integration/lib/auth0/api/v2/api_tickets_spec.rb
435
+ - spec/integration/lib/auth0/api/v2/api_user_blocks_spec.rb
436
+ - spec/integration/lib/auth0/api/v2/api_users_spec.rb
437
+ - spec/integration/lib/auth0/auth0_client_spec.rb
438
+ - spec/lib/auth0/api/authentication_endpoints_spec.rb
439
+ - spec/lib/auth0/api/v2/blacklists_spec.rb
440
+ - spec/lib/auth0/api/v2/client_grants_spec.rb
441
+ - spec/lib/auth0/api/v2/clients_spec.rb
442
+ - spec/lib/auth0/api/v2/connections_spec.rb
443
+ - spec/lib/auth0/api/v2/device_credentials_spec.rb
444
+ - spec/lib/auth0/api/v2/emails_spec.rb
445
+ - spec/lib/auth0/api/v2/jobs_spec.rb
446
+ - spec/lib/auth0/api/v2/logs_spec.rb
447
+ - spec/lib/auth0/api/v2/resource_servers_spec.rb
448
+ - spec/lib/auth0/api/v2/rules_spec.rb
449
+ - spec/lib/auth0/api/v2/stats_spec.rb
450
+ - spec/lib/auth0/api/v2/tenants_spec.rb
451
+ - spec/lib/auth0/api/v2/tickets_spec.rb
452
+ - spec/lib/auth0/api/v2/user_blocks_spec.rb
453
+ - spec/lib/auth0/api/v2/users_by_email_spec.rb
454
+ - spec/lib/auth0/api/v2/users_spec.rb
455
+ - spec/lib/auth0/client_spec.rb
456
+ - spec/lib/auth0/mixins/httpproxy_spec.rb
457
+ - spec/lib/auth0/mixins/initializer_spec.rb
458
+ - spec/spec_helper.rb
459
+ - spec/spec_helper_full.rb
460
+ - spec/spec_helper_unit.rb
461
+ - spec/support/credentials.rb
462
+ - spec/support/dummy_class.rb
463
+ - spec/support/dummy_class_for_proxy.rb
464
+ - spec/support/dummy_class_for_restclient.rb
465
+ - spec/support/import_users.json
466
+ - spec/support/stub_response.rb