Commit bee8ceec authored by Jose Ernesto Suarez's avatar Jose Ernesto Suarez

Se ajustan los test para probar las clases

parent 7ede1e96
example_id | status | run_time | example_id | status | run_time |
------------------------------------ | ------ | --------------- | ------------------------------------ | ------ | --------------- |
./spec/google-wedoops_spec.rb[1:1] | passed | 0.00118 seconds | ./spec/google-wedoops_spec.rb[1:1] | passed | 0.00046 seconds |
./spec/google-wedoops_spec.rb[1:2] | passed | 0.00102 seconds | ./spec/google-wedoops_spec.rb[1:2] | passed | 0.00034 seconds |
./spec/google-wedoops_spec.rb[1:3:1] | passed | 0.00062 seconds | ./spec/google-wedoops_spec.rb[1:3:1] | passed | 0.0006 seconds |
./spec/google-wedoops_spec.rb[1:3:2] | passed | 0.00006 seconds | ./spec/google-wedoops_spec.rb[1:3:2] | passed | 0.0001 seconds |
./spec/google-wedoops_spec.rb[1:4:1] | failed | 0.00007 seconds | ./spec/google-wedoops_spec.rb[1:3:3] | passed | 0.00007 seconds |
./spec/google-wedoops_spec.rb[1:4:2] | failed | 0.00009 seconds | ./spec/google-wedoops_spec.rb[1:3:4] | passed | 0.00008 seconds |
./spec/google-wedoops_spec.rb[1:4:3] | failed | 0.00007 seconds | ./spec/google-wedoops_spec.rb[1:3:5] | passed | 0.00004 seconds |
./spec/google-wedoops_spec.rb[1:4:1] | passed | 0.00008 seconds |
./spec/google-wedoops_spec.rb[1:4:2] | passed | 0.00018 seconds |
./spec/google-wedoops_spec.rb[1:4:3] | passed | 0.00012 seconds |
...@@ -6,10 +6,13 @@ module Wedoops ...@@ -6,10 +6,13 @@ module Wedoops
# Is neccesary the WDSL URLs for the login and transport endpoint # Is neccesary the WDSL URLs for the login and transport endpoint
# as well the array with the different credentials wich will be used # as well the array with the different credentials wich will be used
class Configuration class Configuration
attr_accessor :user attr_accessor :user, :scopes, :user_impersonate, :credentials
def initialize def initialize
@user = nil @user = nil
@scopes = nil
@user_impersonate = nil
@credentials = nil
end end
......
{
"type": "service_account",
"project_id": "-",
"private_key_id": "-",
"private_key": "-",
"client_email": "-",
"client_id": "-",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://oauth2.googleapis.com/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_x509_cert_url": "-"
}
\ No newline at end of file
require 'spec_helper' require 'spec_helper'
require 'stringio' require 'stringio'
def authentication
Wedoops::Google::Authenticator.new(Wedoops::Google.configuration.credentials,Wedoops::Google.configuration.scopes)
end
RSpec.describe Wedoops::Google do RSpec.describe Wedoops::Google do
it 'has a version number' do it 'has a version number' do
expect(Wedoops::Google::VERSION).not_to be nil expect(Wedoops::Google::VERSION).not_to be nil
...@@ -18,20 +22,28 @@ RSpec.describe Wedoops::Google do ...@@ -18,20 +22,28 @@ RSpec.describe Wedoops::Google do
it 'The user is a string' do it 'The user is a string' do
expect(Wedoops::Google.configuration.user).to be_an(String) expect(Wedoops::Google.configuration.user).to be_an(String)
end end
it 'The scopes are an Array' do
expect(Wedoops::Google.configuration.scopes).to be_an(Array)
end
it 'The credentials is a string' do
expect(Wedoops::Google.configuration.credentials).to be_an(String)
end
it 'The user_impersonate is a valid email' do
expect(Wedoops::Google.configuration.user_impersonate).to be_an(String)
end
end end
describe 'Components' do describe 'Components' do
it 'El authenticator es un Wedoops::Google::Autenticator' do it 'El authenticator es un Wedoops::Google::Autenticator' do
expect(Wedoops::Google::Autenticator.new).to be_a_kind_of(Wedoops::Google::Autenticator) expect(Wedoops::Google::Authenticator.new(Wedoops::Google.configuration.credentials,Wedoops::Google.configuration.scopes)).to be_a_kind_of(Wedoops::Google::Authenticator)
end end
it 'El Drive es un Wedoops::Google::Drive' do it 'El Drive es un Wedoops::Google::Drive' do
expect(Wedoops::Google::Drive.new).to be_a_kind_of(Wedoops::Google::Drive) expect(Wedoops::Google::Drive.new(authentication)).to be_a_kind_of(Wedoops::Google::Drive)
end end
it 'El Reseller es un Wedoops::Google::Reseller' do it 'El Reseller es un Wedoops::Google::Reseller' do
expect(Wedoops::Google::Reseller.new).to be_a_kind_of(Wedoops::Google::Reseller) expect(Wedoops::Google::Reseller.new(authentication)).to be_a_kind_of(Wedoops::Google::Reseller)
end end
......
...@@ -7,7 +7,14 @@ RSpec.configure do |conf| ...@@ -7,7 +7,14 @@ RSpec.configure do |conf|
conf.before(:all) do conf.before(:all) do
Wedoops::Google.configure do |config| Wedoops::Google.configure do |config|
puts "Trying to config" puts "Trying to config"
config.user = "Pepito" config.user = "pepito"
config.credentials = "./spec/credentials.json"
config.scopes = ["https://www.googleapis.com/auth/apps.order",
"https://www.googleapis.com/auth/admin.directory.user",
"https://www.googleapis.com/auth/siteverification",
"https://www.googleapis.com/auth/gmail.readonly",
"https://www.googleapis.com/auth/drive"]
config.user_impersonate = "ernesto@appsimplantadores.com"
end end
end end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment