)]}'
{"src/keystone.js":[{"author":{"_account_id":9717,"name":"Michael Krotscheck","email":"krotscheck@gmail.com","username":"krotscheck"},"change_message_id":"ed74b99ba677c14c33ae3186d2f994e36d399d94","unresolved":false,"context_lines":[{"line_number":17,"context_line":"  }"},{"line_number":18,"context_line":""},{"line_number":19,"context_line":"  /**"},{"line_number":20,"context_line":"   * Retrieve all the API versions available. This method caches its results."},{"line_number":21,"context_line":"   *"},{"line_number":22,"context_line":"   * @returns {Promise.\u003cT\u003e} A promise that will resolve with the list of API versions."},{"line_number":23,"context_line":"   */"}],"source_content_type":"text/javascript","patch_set":7,"id":"1ac06dbe_81731fe7","line":20,"updated":"2016-08-24 17:58:13.000000000","message":"Oh. Hah. This is wrong.","commit_id":"06b0fe66489f45acbd2b23b964b0ecf73c2c0b20"}],"test/functional/keystoneTest.js":[{"author":{"_account_id":8614,"name":"Corentin Ardeois","email":"corentin.ardeois@gmail.com","username":"cardeois"},"change_message_id":"ea1d93df93fc17631230377f7ddb1ce9fce5bd22","unresolved":false,"context_lines":[{"line_number":48,"context_line":"     * has changed in a significant way."},{"line_number":49,"context_line":"     */"},{"line_number":50,"context_line":"    it(\"should return a supported version.\", (done) \u003d\u003e {"},{"line_number":51,"context_line":"      keystone.version()"},{"line_number":52,"context_line":"        .then((version) \u003d\u003e {"},{"line_number":53,"context_line":"          // Quick sanity check."},{"line_number":54,"context_line":"          const apiVersion \u003d new Version(version.id);"}],"source_content_type":"text/javascript","patch_set":1,"id":"3ac371cc_75328bf3","line":51,"updated":"2016-08-17 15:15:59.000000000","message":"I don\u0027t see any definition of this function in `keystone.js`","commit_id":"2532bb49beb9ec59294b1fd6457c9a0073ee4c02"}],"test/unit/keystoneTest.js":[{"author":{"_account_id":8614,"name":"Corentin Ardeois","email":"corentin.ardeois@gmail.com","username":"cardeois"},"change_message_id":"ea1d93df93fc17631230377f7ddb1ce9fce5bd22","unresolved":false,"context_lines":[{"line_number":1,"context_line":"import Keystone from \u0027../../src/keystone.js\u0027;"},{"line_number":2,"context_line":"import versions from \u0027./data/keystoneData\u0027;"},{"line_number":3,"context_line":""},{"line_number":4,"context_line":"const fetchMock \u003d require(\u0027fetch-mock\u0027);"},{"line_number":5,"context_line":""},{"line_number":6,"context_line":"describe(\u0027Openstack connection test\u0027, () \u003d\u003e {"},{"line_number":7,"context_line":"  it(\u0027should export a class\u0027, () \u003d\u003e {"}],"source_content_type":"text/javascript","patch_set":1,"id":"3ac371cc_c7691cfb","line":4,"updated":"2016-08-17 15:15:59.000000000","message":"That means import was not working?","commit_id":"2532bb49beb9ec59294b1fd6457c9a0073ee4c02"},{"author":{"_account_id":8614,"name":"Corentin Ardeois","email":"corentin.ardeois@gmail.com","username":"cardeois"},"change_message_id":"ea1d93df93fc17631230377f7ddb1ce9fce5bd22","unresolved":false,"context_lines":[{"line_number":101,"context_line":"        .then(() \u003d\u003e {"},{"line_number":102,"context_line":"          // Validate that the mock has only been invoked once"},{"line_number":103,"context_line":"          expect(fetchMock.calls(authUrl).length).toEqual(1);"},{"line_number":104,"context_line":"          console.log(\u0027foo\u0027);"},{"line_number":105,"context_line":"          return keystone.versions();"},{"line_number":106,"context_line":"        })"},{"line_number":107,"context_line":"        .then(() \u003d\u003e {"}],"source_content_type":"text/javascript","patch_set":1,"id":"3ac371cc_47240cc4","line":104,"updated":"2016-08-17 15:15:59.000000000","message":"Remove this","commit_id":"2532bb49beb9ec59294b1fd6457c9a0073ee4c02"},{"author":{"_account_id":8614,"name":"Corentin Ardeois","email":"corentin.ardeois@gmail.com","username":"cardeois"},"change_message_id":"ea1d93df93fc17631230377f7ddb1ce9fce5bd22","unresolved":false,"context_lines":[{"line_number":111,"context_line":"        .catch((error) \u003d\u003e {"},{"line_number":112,"context_line":"          expect(error).toBeNull();"},{"line_number":113,"context_line":"          done();"},{"line_number":114,"context_line":"        });"},{"line_number":115,"context_line":"    });"},{"line_number":116,"context_line":"  });"},{"line_number":117,"context_line":"});"}],"source_content_type":"text/javascript","patch_set":1,"id":"3ac371cc_822d4faa","line":114,"updated":"2016-08-17 15:15:59.000000000","message":"This tests verifies that once `keystone.versions()` has been called and resolved, other calls won\u0027t refetch the data from API.\n\nHowever even if the `keystone.versions()` is called simultaneously, the promise will be cached. It\u0027s more tricky to test but we can definitely do it by controlling `fetchMock` responses. Something like this: http://paste.openstack.org/show/559050/","commit_id":"2532bb49beb9ec59294b1fd6457c9a0073ee4c02"},{"author":{"_account_id":8614,"name":"Corentin Ardeois","email":"corentin.ardeois@gmail.com","username":"cardeois"},"change_message_id":"a60231e7f18636d40f50eb3ca50b299c81c01318","unresolved":false,"context_lines":[{"line_number":1,"context_line":"import Keystone from \u0027../../src/keystone.js\u0027;"},{"line_number":2,"context_line":"import * as mockData from \u0027./helpers/data/keystone\u0027;"},{"line_number":3,"context_line":""},{"line_number":4,"context_line":"const fetchMock \u003d require(\u0027fetch-mock\u0027);"},{"line_number":5,"context_line":""},{"line_number":6,"context_line":"describe(\u0027Keystone\u0027, () \u003d\u003e {"},{"line_number":7,"context_line":""}],"source_content_type":"text/javascript","patch_set":7,"id":"1ac06dbe_7b721a4b","line":4,"updated":"2016-08-24 14:56:37.000000000","message":"Can you explain why this needs to be a \"require\" not \"import\"?","commit_id":"06b0fe66489f45acbd2b23b964b0ecf73c2c0b20"},{"author":{"_account_id":9717,"name":"Michael Krotscheck","email":"krotscheck@gmail.com","username":"krotscheck"},"change_message_id":"76251025ad738a33bbe65487573aa4ae5b2fed0b","unresolved":false,"context_lines":[{"line_number":1,"context_line":"import Keystone from \u0027../../src/keystone.js\u0027;"},{"line_number":2,"context_line":"import * as mockData from \u0027./helpers/data/keystone\u0027;"},{"line_number":3,"context_line":""},{"line_number":4,"context_line":"const fetchMock \u003d require(\u0027fetch-mock\u0027);"},{"line_number":5,"context_line":""},{"line_number":6,"context_line":"describe(\u0027Keystone\u0027, () \u003d\u003e {"},{"line_number":7,"context_line":""}],"source_content_type":"text/javascript","patch_set":7,"id":"1ac06dbe_01f28f6f","line":4,"in_reply_to":"1ac06dbe_7b721a4b","updated":"2016-08-24 17:56:59.000000000","message":"Ah, copy/pasta from me trying to get tests to work. Can change.","commit_id":"06b0fe66489f45acbd2b23b964b0ecf73c2c0b20"},{"author":{"_account_id":8614,"name":"Corentin Ardeois","email":"corentin.ardeois@gmail.com","username":"cardeois"},"change_message_id":"a60231e7f18636d40f50eb3ca50b299c81c01318","unresolved":false,"context_lines":[{"line_number":82,"context_line":"        .then(() \u003d\u003e {"},{"line_number":83,"context_line":"          expect(fetchMock.calls(mockOptions.name).length).toEqual(2);"},{"line_number":84,"context_line":"          done();"},{"line_number":85,"context_line":"        })"},{"line_number":86,"context_line":"        .catch(() \u003d\u003e done.fail());"},{"line_number":87,"context_line":"    });"},{"line_number":88,"context_line":"  });"}],"source_content_type":"text/javascript","patch_set":7,"id":"1ac06dbe_1be7a6ad","line":85,"updated":"2016-08-24 14:56:37.000000000","message":"This tests verifies that once `keystone.versions()` has been called and resolved, other calls won\u0027t refetch the data from API.\nHowever even if the `keystone.versions()` is called simultaneously, the promise will be cached. It\u0027s more tricky to test but we can definitely do it by controlling `fetchMock` responses. Something like this: http://paste.openstack.org/show/559050/","commit_id":"06b0fe66489f45acbd2b23b964b0ecf73c2c0b20"},{"author":{"_account_id":9717,"name":"Michael Krotscheck","email":"krotscheck@gmail.com","username":"krotscheck"},"change_message_id":"76251025ad738a33bbe65487573aa4ae5b2fed0b","unresolved":false,"context_lines":[{"line_number":82,"context_line":"        .then(() \u003d\u003e {"},{"line_number":83,"context_line":"          expect(fetchMock.calls(mockOptions.name).length).toEqual(2);"},{"line_number":84,"context_line":"          done();"},{"line_number":85,"context_line":"        })"},{"line_number":86,"context_line":"        .catch(() \u003d\u003e done.fail());"},{"line_number":87,"context_line":"    });"},{"line_number":88,"context_line":"  });"}],"source_content_type":"text/javascript","patch_set":7,"id":"1ac06dbe_01a56fb4","line":85,"in_reply_to":"1ac06dbe_1be7a6ad","updated":"2016-08-24 17:56:59.000000000","message":"Are you sure? keystone.versions() always reconstructs the promise chain, meaning that a new promise instance is returned every time. Since the Promise API is idempotent, returning this new promise in line 80 effectively chains two calls, one after the other, ensuring that they both get caught by fetchMock.\n\nMaybe could you explain how \"other calls won\u0027t refetch the data from API.\" ? I don\u0027t see it.","commit_id":"06b0fe66489f45acbd2b23b964b0ecf73c2c0b20"}]}
