Skip to content

Commit

Permalink
Adopt spec to InfluxCommunity#248
Browse files Browse the repository at this point in the history
  • Loading branch information
hennevogel committed Feb 6, 2021
1 parent 409f1e1 commit 63ee836
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions spec/influxdb/cases/query_cluster_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
describe "#create_cluster_admin" do
let(:user) { 'adminadmin' }
let(:pass) { 'passpass' }
let(:query) { "CREATE USER #{user} WITH PASSWORD '#{pass}' WITH ALL PRIVILEGES" }
let(:query) { "CREATE USER \"#{user}\" WITH PASSWORD '#{pass}' WITH ALL PRIVILEGES" }

context 'with existing admin user' do
before do
Expand Down Expand Up @@ -67,7 +67,7 @@

describe "#revoke_cluster_admin_privileges" do
let(:user) { 'useruser' }
let(:query) { "REVOKE ALL PRIVILEGES FROM #{user}" }
let(:query) { "REVOKE ALL PRIVILEGES FROM \"#{user}\"" }

before do
stub_request(:get, "http://influxdb.test:9999/query").with(
Expand Down
2 changes: 1 addition & 1 deletion spec/influxdb/cases/query_continuous_query_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
describe "#delete_continuous_query" do
let(:name) { "event_counts_per_10m_by_type" }
let(:database) { "testdb" }
let(:query) { "DROP CONTINUOUS QUERY #{name} ON #{database}" }
let(:query) { "DROP CONTINUOUS QUERY \"#{name}\" ON \"#{database}\"" }

before do
stub_request(:get, "http://influxdb.test:9999/query")
Expand Down
6 changes: 3 additions & 3 deletions spec/influxdb/cases/query_database_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@

describe "#create_database" do
describe "from param" do
let(:query) { "CREATE DATABASE foo" }
let(:query) { "CREATE DATABASE \"foo\"" }

it "should GET to create a new database" do
expect(subject.create_database("foo")).to be_a(Net::HTTPOK)
end
end

describe "from config" do
let(:query) { "CREATE DATABASE database" }
let(:query) { "CREATE DATABASE \"database\"" }

it "should GET to create a new database using database name from config" do
expect(subject.create_database).to be_a(Net::HTTPOK)
Expand All @@ -49,7 +49,7 @@
end

describe "from config" do
let(:query) { "DROP DATABASE database" }
let(:query) { "DROP DATABASE \"database\"" }

it "should GET to remove a database using database name from config" do
expect(subject.delete_database).to be_a(Net::HTTPOK)
Expand Down
16 changes: 8 additions & 8 deletions spec/influxdb/cases/query_user_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
describe "#update user password" do
let(:user) { 'useruser' }
let(:pass) { 'passpass' }
let(:query) { "SET PASSWORD FOR #{user} = '#{pass}'" }
let(:query) { "SET PASSWORD FOR \"#{user}\" = '#{pass}'" }

it "should GET to update user password" do
expect(subject.update_user_password(user, pass)).to be_a(Net::HTTPOK)
Expand All @@ -35,7 +35,7 @@
let(:user) { 'useruser' }
let(:perm) { :write }
let(:db) { 'foo' }
let(:query) { "GRANT #{perm.to_s.upcase} ON #{db} TO #{user}" }
let(:query) { "GRANT #{perm.to_s.upcase} ON \"#{db}\" TO \"#{user}\"" }

it "should GET to grant privileges for a user on a database" do
expect(subject.grant_user_privileges(user, db, perm)).to be_a(Net::HTTPOK)
Expand All @@ -44,7 +44,7 @@

describe "#grant_user_admin_privileges" do
let(:user) { 'useruser' }
let(:query) { "GRANT ALL PRIVILEGES TO #{user}" }
let(:query) { "GRANT ALL PRIVILEGES TO \"#{user}\"" }

it "should GET to grant privileges for a user on a database" do
expect(subject.grant_user_admin_privileges(user)).to be_a(Net::HTTPOK)
Expand All @@ -55,7 +55,7 @@
let(:user) { 'useruser' }
let(:perm) { :write }
let(:db) { 'foo' }
let(:query) { "REVOKE #{perm.to_s.upcase} ON #{db} FROM #{user}" }
let(:query) { "REVOKE #{perm.to_s.upcase} ON \"#{db}\" FROM \"#{user}\"" }

it "should GET to revoke privileges from a user on a database" do
expect(subject.revoke_user_privileges(user, db, perm)).to be_a(Net::HTTPOK)
Expand All @@ -66,7 +66,7 @@
let(:user) { 'useruser' }
let(:pass) { 'passpass' }
let(:db) { 'foo' }
let(:query) { "CREATE user #{user} WITH PASSWORD '#{pass}'; GRANT ALL ON #{db} TO #{user}" }
let(:query) { "CREATE user #{user} WITH PASSWORD '#{pass}'; GRANT ALL ON \"#{db}\" TO \"#{user}\"" }

context "without specifying permissions" do
it "should GET to create a new database user with all permissions" do
Expand All @@ -76,7 +76,7 @@

context "with passing permission as argument" do
let(:permission) { :read }
let(:query) { "CREATE user #{user} WITH PASSWORD '#{pass}'; GRANT #{permission.to_s.upcase} ON #{db} TO #{user}" }
let(:query) { "CREATE user \"#{user}\" WITH PASSWORD '#{pass}'; GRANT #{permission.to_s.upcase} ON \"#{db}\" TO \"#{user}\"" }

it "should GET to create a new database user with permission set" do
expect(subject.create_database_user(db, user, pass, permissions: permission)).to be_a(Net::HTTPOK)
Expand All @@ -86,7 +86,7 @@

describe "#delete_user" do
let(:user) { 'useruser' }
let(:query) { "DROP USER #{user}" }
let(:query) { "DROP USER \"#{user}\"" }

it "should GET to delete a user" do
expect(subject.delete_user(user)).to be_a(Net::HTTPOK)
Expand All @@ -105,7 +105,7 @@

describe "#list_user_grants" do
let(:user) { 'useruser' }
let(:list_query) { "SHOW GRANTS FOR #{user}" }
let(:list_query) { "SHOW GRANTS FOR \"#{user}\"" }

before do
stub_request(:get, "http://influxdb.test:9999/query")
Expand Down

0 comments on commit 63ee836

Please sign in to comment.