Sha256: 75d17e2214775eb814628c16d7e312f3419a42759479621599f34ae66f5c37f9

Contents?: true

Size: 1.38 KB

Versions: 2

Compression:

Stored size: 1.38 KB

Contents

require "spec_helper"
describe Auth0::Api::V1::Users do

  let(:client) { Auth0Client.new(v1_creds) }
  let(:username) { Faker::Internet.user_name }
  let(:email) { "#{entity_suffix}#{Faker::Internet.safe_email(username)}" }
  let(:password) { Faker::Internet.password }
  let(:connection) { "Username-Password-Authentication" }
  let!(:user) { client.create_user(email, password, connection, {
    "username" => username,
    "email_verified" => false,
  })}

  describe '.users' do

    let(:users) { client.users() }

    it { expect(users.size).to be > 0 }

    context "#filters" do
      it { expect(client.users("email: #{email}").size).to be 1 }
    end

  end

  describe '.user' do

    let(:subject) { client.user(user["user_id"]) }

    it { should include("email" => email, "username" => username) }

  end

  describe '.create_user' do

    let(:subject) { user }

    it { should include("user_id", "identities") }
    it { should include(      
      "username" => username,
      "email" => email,
      "email_verified" => false,
    )}

  end

  describe '.delete_user' do

    it { expect { client.delete_user user["user_id"] }.to_not raise_error }

    it { expect { client.delete_user "" }.to raise_error(Auth0::MissingUserId) }

  end

  describe '.patch_user_metadata' do
    it { expect(client.patch_user_metadata(user["user_id"], {"custom_field" => "custom_value"})).to eq "OK" }
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
auth0-3.6.1 spec/integration/lib/auth0/api/v1/api_users_spec.rb
auth0-3.6.0 spec/integration/lib/auth0/api/v1/api_users_spec.rb