Sha256: 5fe73667cbfedd1634993d8aefeda046c87a14cbecca5cb4ae5349613db4d1ae

Contents?: true

Size: 1.08 KB

Versions: 21

Compression:

Stored size: 1.08 KB

Contents

require "helpers/integration_test_helper"
require "integration/factories/sql_instances_factory"
require "integration/factories/sql_users_factory"

class TestSQLUsers < FogIntegrationTest
  # This test doesn't include TestCollection as Users is not a
  # classical Fog model, as it's tied to a particular instance
  # I.e.:
  # - Fog::Google::SQL.users.all() requires an instance
  # - API doesn't provide a GET request for Users model
  # See: https://cloud.google.com/sql/docs/mysql/admin-api/v1beta4/users

  def setup
    @subject = Fog::Google[:sql].users
    @factory = SqlUsersFactory.new(namespaced_name)
  end

  def teardown
    @factory.cleanup
  end

  def test_users
    # Create user
    user = @factory.create

    # Check user was created
    users = @subject.all(user.instance).select { |u| u.name == user.name }
    assert_equal(1, users.size, "expected user to have been created")

    # Delete user
    users.first.destroy(:async => false)
    assert_empty(
      @subject.all(user.instance).select { |u| u.name == user.name },
      "expected no user #{user.name}"
    )
  end
end

Version data entries

21 entries across 21 versions & 2 rubygems

Version Path
fog-google-1.24.1 test/integration/sql/test_users.rb
fog-google-1.24.0 test/integration/sql/test_users.rb
fog-google-1.23.0 test/integration/sql/test_users.rb
fog-google-1.22.0 test/integration/sql/test_users.rb
fog-google-1.21.1 test/integration/sql/test_users.rb
fog-google-1.21.0 test/integration/sql/test_users.rb
fog-google-1.20.0 test/integration/sql/test_users.rb
fog-google-1.19.0 test/integration/sql/test_users.rb
fog-google-1.18.0 test/integration/sql/test_users.rb
fog-google-1.17.0 test/integration/sql/test_users.rb
fog-google-1.16.1 test/integration/sql/test_users.rb
fog-google-1.16.0 test/integration/sql/test_users.rb
fog-google-1.15.0 test/integration/sql/test_users.rb
fog-google-1.14.0 test/integration/sql/test_users.rb
gitlab-fog-google-1.14.0 test/integration/sql/test_users.rb
fog-google-1.13.0 test/integration/sql/test_users.rb
gitlab-fog-google-1.13.0 test/integration/sql/test_users.rb
fog-google-1.12.1 test/integration/sql/test_users.rb
fog-google-1.12.0 test/integration/sql/test_users.rb
fog-google-1.11.0 test/integration/sql/test_users.rb