#
# Copyright (C) 2020 - present Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
#

module CdcFixtures
  def self.create_web_conference
    ps = PluginSetting.find_or_create_by(name: 'adobe_connect')
    ps.disabled = false
    ps.save!

    return WebConference.new({
      title: 'default',
      conference_type: 'AdobeConnect',
      context_id: 1,
      context_type: 'Course',
      user_id: 1,
    })
  end
end

#
# Copyright (C) 2020 - present Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
#

module CdcFixtures
  def self.create_web_conference
    ps = PluginSetting.find_or_create_by(name: 'adobe_connect')
    ps.settings = {}
    ps.disabled = false
    ps.save!

    return WebConference.new({
      title: 'default',
      conference_type: 'AdobeConnect',
      context_id: 1,
      context_type: 'Course',
      user_id: 1,
    })
  end
end

Set empty settings hash when creating a PluginSetting
spec: Set empty settings hash when creating a PluginSetting

Plugin.enabled? will return false if the PluginSetting has an
empty settings hash, even if PluginSetting.disabled is false.

A conference-type plugin needs to be enabled before a WebConference
can be created. And a WebConference needs to be created to test
the web_conferences table in the CDC build.

test plan:
- RAILS_ENV=test bundle exec rake db:test:fill_tables does not error

refs PLAT-5394

Change-Id: Ia4d1b762a3f1427e3c2378cadd4d4d1a9d0899cd
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/229736
Tested-by: Service Cloud Jenkins <9144042a601061f88f1e1d7a1753ea3e2972119d@instructure.com>
Reviewed-by: Evan Battaglia <e557ffdfc4b80aab44858030b0ae5370b86cb7b1@instructure.com>
Reviewed-by: Tucker Mcknight <4b51b98c1d84aa97854d216bd061ce5d3eda8a28@instructure.com>
QA-Review: Tucker Mcknight <4b51b98c1d84aa97854d216bd061ce5d3eda8a28@instructure.com>
Product-Review: Tucker Mcknight <4b51b98c1d84aa97854d216bd061ce5d3eda8a28@instructure.com>
