Skip to content

Commit

Permalink
TESTING: add simple client to ease test
Browse files Browse the repository at this point in the history
  • Loading branch information
dgdavid committed Feb 21, 2020
1 parent b1efd81 commit 7c3df31
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/clients/test_addon_selection.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
require "registration/clients/test_addon_selection"
Yast::TestAddonSelectionClient.new.main
64 changes: 64 additions & 0 deletions src/lib/registration/clients/test_addon_selection.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Copyright (c) [2019] SUSE LLC
#
# All Rights Reserved.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of version 2 of the GNU General Public License as published
# by the Free Software Foundation.
#
# This program 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 General Public License for
# more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, contact SUSE LLC.
#
# To contact SUSE LLC about this file by physical or electronic mail, you may
# find current contact information at www.suse.com.

require "suse/connect"
require "registration/ui/addon_selection_registration_dialog"

class RegistrationMock
def activated_products
YAML.load_file("test/fixtures/activated_products.yml")
end

def get_addon_list
YAML.load_file("test/fixtures/pure_addons.yml")
end

def addon_generator(params = {})
SUSE::Connect::Remote::Product.new(suse_connect_product_generator(params))
end
end

module Yast
class Registration::Addon
def self.find_all(registration)
YAML.load_file("test/fixtures/sle15_addons.yaml")
end
end

class TestAddonSelectionClient < Client
def main
Yast.import "Mode"
Yast.import "Stage"
Yast.import "Wizard"


Stage.Set("continue")
Mode.SetMode("installation")

Wizard.CreateDialog

registration = RegistrationMock.new
Registration::UI::AddonSelectionRegistrationDialog.run(registration)

Wizard.CloseDialog

true
end
end
end

0 comments on commit 7c3df31

Please sign in to comment.