spec: don't run GraphQL audit log spec without dynamo

`before(:once)` gets run _before_ `before(:each)` blocks, so it was
still running and failing if dynamo isn't configured

Change-Id: Ic79aabecf1146f7f49125f56b2c53da94127f907
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/358305
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
This commit is contained in:
Cody Cutrer 2024-09-24 08:59:35 -06:00
parent 76a5dc6534
commit 6e270e9ad3
1 changed files with 10 additions and 0 deletions

View File

@ -29,6 +29,8 @@ describe AuditLogFieldExtension do
end
before(:once) do
next unless AuditLogFieldExtension.enabled?
creds = Aws::Credentials.new("key", "secret")
Canvas::DynamoDB::DevUtils.initialize_ddb_for_development!(:auditors, "graphql_mutations", recreate: true, credentials: creds)
course_with_student(active_all: true)
@ -91,6 +93,8 @@ describe AuditLogFieldExtension::Logger do
let(:mutation) { double(graphql_name: "asdf") }
before(:once) do
next unless AuditLogFieldExtension.enabled?
WebMock.enable_net_connect!
creds = Aws::Credentials.new("key", "secret")
Canvas::DynamoDB::DevUtils.initialize_ddb_for_development!(:auditors, "graphql_mutations", recreate: true, credentials: creds)
@ -121,6 +125,12 @@ describe AuditLogFieldExtension::Logger do
end
context "#log_entry_ids" do
before do
unless AuditLogFieldExtension.enabled?
skip("AuditLog needs to be enabled by configuring dynamodb.yml")
end
end
it "uses #asset_string and includes the domain_root_account id for the object_id" do
logger = AuditLogFieldExtension::Logger.new(mutation, {}, { input: {} })
expect(logger.log_entry_ids(@entry, "some_field")).to eq ["#{@course.root_account.global_id}-assignment_#{@entry.id}"]