Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(102)

Unified Diff: test/test_inspector_charm.js

Issue 11517043: Initial pass at charm details in inspector
Patch Set: Initial pass at charm details in inspector Created 10 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/test_browser_charm_details.js ('k') | test/test_view_container.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/test_inspector_charm.js
=== added file 'test/test_inspector_charm.js'
--- test/test_inspector_charm.js 1970-01-01 00:00:00 +0000
+++ test/test_inspector_charm.js 2013-07-18 14:23:40 +0000
@@ -0,0 +1,88 @@
+/*
+This file is part of the Juju GUI, which lets users view and manage Juju
+environments within a graphical interface (https://launchpad.net/juju-gui).
+Copyright (C) 2012-2013 Canonical Ltd.
+
+This program is free software: you can redistribute it and/or modify it under
+the terms of the GNU Affero General Public License version 3, 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 warranties of MERCHANTABILITY,
+SATISFACTORY QUALITY, 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/>.
+*/
+
+'use strict';
+
+describe('Inspector Charm', function() {
+ var charmID, container, fakeCharm, fakeStore, utils, viewlets, views, Y;
+
+ before(function(done) {
+ Y = YUI(GlobalConfig).use([
+ 'viewlet-charm-details',
+ 'juju-charm-store',
+ 'juju-tests-utils',
+ 'subapp-browser-views'
+ ], function(Y) {
+ utils = Y.namespace('juju-tests.utils');
+ viewlets = Y.namespace('juju.viewlets');
+ views = Y.namespace('juju.browser.views');
+
+ charmID = 'precise/apache2-10';
+ fakeCharm = {
+ get: function() {
+ return charmID;
+ }
+ };
+ window.flags = {serviceInspector: true};
+ done();
+ });
+ });
+
+ after(function() {
+ delete window.flags;
+ });
+
+ it('should ensure the viewlet exists', function() {
+ assert.equal(typeof viewlets.charmDetails, 'object');
+ });
+
+ it('renders the viewlet with a charm', function(done) {
+ var data = utils.loadFixture('data/browsercharm.json', false);
+ var testContainer = utils.makeContainer();
+
+ var fakeStore = new Y.juju.Charmworld2({});
+ fakeStore.set('datasource', {
+ sendRequest: function(params) {
+ // Stubbing the server callback value
+ params.callback.success({
+ response: {
+ results: [{
+ responseText: data
+ }]
+ }
+ });
+ }
+ });
+
+ views.BrowserCharmView = function(cfg) {
+ assert.isTrue(cfg.forInspector);
+ assert.equal(typeof cfg.store, 'object');
+ assert.equal(cfg.charm.get('id'), charmID);
+ return {
+ render: function() { done(); }
+ };
+ };
+ var viewletAttrs = {
+ store: fakeStore
+ };
+
+ viewlets.charmDetails.container = testContainer;
+ var content = viewlets.charmDetails.render(fakeCharm, viewletAttrs);
+ testContainer.setHTML('content');
+ });
+});
« no previous file with comments | « test/test_browser_charm_details.js ('k') | test/test_view_container.js » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b