Skip to content

Instantly share code, notes, and snippets.

View jlsherrill's full-sized avatar

Justin Sherrill jlsherrill

View GitHub Profile
describe('Controller: SystemEventsController', function() {
var $scope, Nutupane, SystemTask, SystemTaskPoll, $httpBackend, mockedTasks;
beforeEach(module('Bastion.systems', 'Bastion.test-mocks'));
beforeEach(function() {
inject(function(_$httpBackend_) {
$httpBackend = _$httpBackend_;
});
it("Performs a package update", function(){
$scope.packageAction.actionType = "packageUpdate";
$scope.packageAction.term = "foo";
$scope.performPackageAction();
expect(SystemPackage).toHaveBeenCalledWith('update', {uuid: mockSystem.uuid, packages: ["foo"]})
});
/**
* Copyright 2013 Red Hat, Inc.
*
* This software is licensed to you under the GNU General Public
* License as published by the Free Software Foundation; either version
* 2 of the License (GPLv2) or (at your option) any later version.
* There is NO WARRANTY for this software, express or implied,
* including the implied warranties of MERCHANTABILITY,
* NON-INFRINGEMENT, or FITNESS FOR A PARTICULAR PURPOSE. You should
* have received a copy of GPLv2 along with this software; if not, see
diff --git a/test/controllers/api/v2/content_view_puppet_modules_controller_test.rb b/test/controllers/api/v2/content_view_puppet_modules_controller_test.rb
index bcb799d..2a5978a 100644
--- a/test/controllers/api/v2/content_view_puppet_modules_controller_test.rb
+++ b/test/controllers/api/v2/content_view_puppet_modules_controller_test.rb
@@ -42,6 +42,7 @@ module Katello
@fake_search_service = @controller.load_search_service(Support::SearchService::FakeSearchService.new)
models
permissions
+ ContentViewPuppetModule.any_instance.stubs(:puppet_module).returns(PuppetModule.new)
end
diff --git a/test/controllers/api/v2/content_views_controller_test.rb b/test/controllers/api/v2/content_views_controller_test.rb
index 69ba5d6..6b0eb59 100644
--- a/test/controllers/api/v2/content_views_controller_test.rb
+++ b/test/controllers/api/v2/content_views_controller_test.rb
@@ -184,7 +184,7 @@ module Katello
get :available_puppet_modules, :id => @content_view.id
assert_response :success
- assert_template 'katello/api/v2/content_views/../puppet_modules/index'
+ assert_template 'katello/api/v2/content_views/puppet_modules'
diff --git a/app/controllers/katello/api/v2/api_controller.rb b/app/controllers/katello/api/v2/api_controller.
index d5bc7c5..8857125 100644
--- a/app/controllers/katello/api/v2/api_controller.rb
+++ b/app/controllers/katello/api/v2/api_controller.rb
@@ -88,6 +88,7 @@ module Katello
@search_service.model = item_class
options[:per_page] = 1
options[:facets] = {facet_name => term}
+ options[:facet_filters] = options[:filters]
@jlsherrill
jlsherrill / gist:9793345
Last active August 29, 2015 13:57
Asset loading speedup for foreman/katello
--- a/config.ru
+++ b/config.ru
@@ -4,5 +4,6 @@ require ::File.expand_path('../config/environment', __FILE__)
# apply a prefix to the application, if one is defined
# e.g. http://some.server.com/prefix where '/prefix' is defined by env variable
map ENV['RAILS_RELATIVE_URL_ROOT'] || '/' do
+ map("/assets"){ run Rails.application.assets }
run Foreman::Application
end
#!/bin/bash
#
# Copyright 2013 Red Hat, Inc.
#
# This software is licensed to you under the GNU General Public
# License as published by the Free Software Foundation; either version
# 2 of the License (GPLv2) or (at your option) any later version.
# There is NO WARRANTY for this software, express or implied,
# including the implied warranties of MERCHANTABILITY,
# NON-INFRINGEMENT, or FITNESS FOR A PARTICULAR PURPOSE. You should
diff --git a/db/seeds.rb b/db/seeds.rb
index e7964bb..1aa86fa 100644
--- a/db/seeds.rb
+++ b/db/seeds.rb
@@ -16,8 +16,9 @@ def format_errors(model = nil)
model.errors.full_messages.join(';')
end
+::User.current = ::User.anonymous_api_admin
+
def plan(repo)
action_subject(repo)
sequence do
other_actions = []
sync_task = plan_action(Pulp::Repository::Sync, pulp_id: repo.pulp_id)
concurrence do
other_actions << plan_action(Katello::Repository::NodeMetadataGenerate, repo, sync_task.output[:pulp_tasks])
other_actions << plan_action(ElasticSearch::Repository::IndexContent, pulp_task: sync_task.output[:pulp_tasks], id: repo.id)