Merge lp:~jcsackett/juju-gui/search-api into lp:juju-gui/experimental
Proposed by
j.c.sackett
Status: | Merged |
---|---|
Merged at revision: | 554 |
Proposed branch: | lp:~jcsackett/juju-gui/search-api |
Merge into: | lp:juju-gui/experimental |
Diff against target: |
71 lines (+50/-0) 2 files modified
app/store/charm.js (+17/-0) test/test_charm_store.js (+33/-0) |
To merge this branch: | bzr merge lp:~jcsackett/juju-gui/search-api |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Juju GUI Hackers | Pending | ||
Review via email: mp+158929@code.launchpad.net |
Description of the change
Adds call to API client for charm search
-Adds a method, search, to CharmworldAPI0, to make the search API call.
-Adds a test for it.
Nothing in this is wired into anything; it's used by a subsequent branch that
is doing the sidebar search view.
To post a comment you must log in.
Reviewers: mp+158929_ code.launchpad. net,
Message:
Please take a look.
Description:
Adds call to API client for charm search
-Adds a method, search, to CharmworldAPI0, to make the search API call.
-Adds a test for it.
Nothing in this is wired into anything; it's used by a subsequent branch
that
is doing the sidebar search view.
https:/ /code.launchpad .net/~jcsackett /juju-gui/ search- api/+merge/ 158929
(do not edit description out of merge proposal)
Please review this at https:/ /codereview. appspot. com/8612045/
Affected files: charm_store. js
A [revision details]
M app/store/charm.js
M test/test_
Index: [revision details]
=== added file '[revision details]'
--- [revision details] 2012-01-01 00:00:00 +0000
+++ [revision details] 2012-01-01 00:00:00 +0000
@@ -0,0 +1,2 @@
+Old revision:
<email address hidden>
+New revision: <email address hidden>
Index: test/test_ charm_store. js charm_store. js' charm_store. js 2013-03-26 20:36:21 +0000 charm_store. js 2013-04-15 13:54:32 +0000
=== modified file 'test/test_
--- test/test_
+++ test/test_
@@ -281,6 +281,38 @@
});
+ it('handles searching correctly', function(done) { localhost', Charmworld0( { Local({ source: data}), realSendRequest = datasource. sendRequest; sendRequest = function(params) { realSendRequest (params) ; 'datasource' , datasource); equal(' charms? text=foo' , url);
+ var hostname = 'http://
+ api = new Y.juju.
+ apiHost: hostname
+ }),
+ data = [];
+ data.push({
+ responseText: Y.JSON.stringify({
+ name: 'foo'
+ })
+ });
+ // Create a monkeypatched datasource we can use to track the
generated
+ // apiEndpoint
+ var datasource = new Y.DataSource.
+ url;
+ datasource.
+ datasource.
+ url = params.request;
+ datasource.
+ };
+
+ api.set(
+ var result = api.search('foo', {
+ success: function(data) {
+ assert.
+ assert.equal('foo', data.name);
+ done();
+ },
+ failure: function(data, request) {
+ }
+ }, this);
+ });
});
})();
Index: app/store/charm.js charm.js'
=== modified file 'app/store/
--- app/store/charm.js 2013-04-08 21:03:12 +0000
+++ app/store/charm.js 2013-04-15 14:02:02 +0000
@@ -202,6 +202,21 @@
},
/** callbacks. success, bindScope); callbacks. failure, bindScope); st(endpoint, callbacks, {text: text});
+ * Api call to search charms
+ *
+ * @method search
+ * @param {String} text the search text.
+ */
+ search: function(text, callbacks, bindScope) {
+ var endpoint = 'charms';
+ if (bindScope) {
+ callbacks.success = Y.bind(
+ callbacks.failure = Y.bind(
+ }
+ this._makeReque
+ },
+
+ /**
* Fetch the contents of a charm's file.
*
* @method file