)]}'
{"nova/tests/integrated/test_api_samples.py":[{"author":{"_account_id":1247,"name":"Mark McLoughlin","email":"markmc@redhat.com","username":"markmc"},"change_message_id":"3c7eeea10eacf4dfed03129d4e344a849b8c9f33","unresolved":false,"context_lines":[{"line_number":1,"context_line":"# vim: tabstop\u003d4 shiftwidth\u003d4 softtabstop\u003d4"},{"line_number":2,"context_line":""},{"line_number":3,"context_line":"# Copyright 2012 OpenStack, LLC"},{"line_number":4,"context_line":"#"},{"line_number":5,"context_line":"#    Licensed under the Apache License, Version 2.0 (the \"License\"); you may"},{"line_number":6,"context_line":"#    not use this file except in compliance with the License. You may obtain"}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAALH%2F%2FrWs%3D","line":3,"updated":"2012-08-21 10:35:17.000000000","message":"Btw, we discussed this on openstack-dev the other day\n\nAre you sure this Copyright notice is correct - how does the copyright for this code come to be assigned to OpenStack LLC? Are you sure Nebula wouldn\u0027t be more accurate?","commit_id":"29b30da94bc3d40a91789fe750c7c8058b10994e"},{"author":{"_account_id":1247,"name":"Mark McLoughlin","email":"markmc@redhat.com","username":"markmc"},"change_message_id":"3c7eeea10eacf4dfed03129d4e344a849b8c9f33","unresolved":false,"context_lines":[{"line_number":31,"context_line":"    cfg.BoolOpt(\u0027generate_api_samples\u0027,"},{"line_number":32,"context_line":"               default\u003dFalse,"},{"line_number":33,"context_line":"               help\u003d\"Generate api sample files from integration tests\"),"},{"line_number":34,"context_line":"]"},{"line_number":35,"context_line":""},{"line_number":36,"context_line":"FLAGS \u003d flags.FLAGS"},{"line_number":37,"context_line":"FLAGS.register_opts(sample_opts)"}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAALH%2F%2FrWw%3D","line":34,"updated":"2012-08-21 10:35:17.000000000","message":"I don\u0027t really see the point of a flag here. What does it give over just\n\n  # Set this to True to generate api sample files from integration tests\n  GENERATE_API_SAMPLES \u003d False\n\ni.e. you need to edit the code to enable it, so this works just as well","commit_id":"29b30da94bc3d40a91789fe750c7c8058b10994e"},{"author":{"_account_id":1247,"name":"Mark McLoughlin","email":"markmc@redhat.com","username":"markmc"},"change_message_id":"3c7eeea10eacf4dfed03129d4e344a849b8c9f33","unresolved":false,"context_lines":[{"line_number":72,"context_line":"            instance[\u0027info_cache\u0027] \u003d {\u0027network_info\u0027: get_fake_cache()}"},{"line_number":73,"context_line":"    else:"},{"line_number":74,"context_line":"        instances[\u0027info_cache\u0027] \u003d {\u0027network_info\u0027: get_fake_cache()}"},{"line_number":75,"context_line":"    return instances"},{"line_number":76,"context_line":""},{"line_number":77,"context_line":""},{"line_number":78,"context_line":"class ApiSampleTestBase(integrated_helpers._IntegratedTestBase):"}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAALH%2F%2FrWo%3D","line":75,"updated":"2012-08-21 10:35:17.000000000","message":"I haven\u0027t given it much thought, but if there was a way to void hardcoding network_info cache knowledge here, that would be great.\n\nIf we ever go to re-work the network_info cache stuff, it\u0027d be nice not to have to update places like this","commit_id":"29b30da94bc3d40a91789fe750c7c8058b10994e"},{"author":{"_account_id":1247,"name":"Mark McLoughlin","email":"markmc@redhat.com","username":"markmc"},"change_message_id":"3c7eeea10eacf4dfed03129d4e344a849b8c9f33","unresolved":false,"context_lines":[{"line_number":84,"context_line":"                   use_ipv6\u003dFalse,"},{"line_number":85,"context_line":"                   osapi_compute_link_prefix\u003dself._get_host())"},{"line_number":86,"context_line":"        if self.extension_name !\u003d \u0027all_extensions\u0027:"},{"line_number":87,"context_line":"            self.flags(osapi_compute_extension\u003d[self.extension_name])"},{"line_number":88,"context_line":"        super(ApiSampleTestBase, self).setUp()"},{"line_number":89,"context_line":"        orig_get \u003d api.API.get"},{"line_number":90,"context_line":"        orig_get_all \u003d api.API.get_all"}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAALH%2F%2FrW8%3D","line":87,"updated":"2012-08-21 10:35:17.000000000","message":"This is a bit obtuse, how about\n\n  class ApiSampleTestBase:\n      all_extensions \u003d False\n      extension_name \u003d None\n\n      def setUp(self):\n          ...\n          if not self.all_extensions:\n              exts \u003d [self.extension_name] if self.extension_name else []         \n              self.flags(osapi_compute_extension\u003dexts)\n          ...\n\n      @classmethod\n      def _get_sample(...):\n          ...\n          if cls.all_extensions:\n              parts.append(\u0027all_extensions\u0027)\n          elif cls.extension_name:\n              parts.append(cls.extension_name)\n\ni.e. this way there\u0027s only one place the name \u0027all_extensions\u0027 is significant, just the path in the tests dir\n\nIndeed, you could remove extension_name completely from this patch","commit_id":"29b30da94bc3d40a91789fe750c7c8058b10994e"},{"author":{"_account_id":1247,"name":"Mark McLoughlin","email":"markmc@redhat.com","username":"markmc"},"change_message_id":"3c7eeea10eacf4dfed03129d4e344a849b8c9f33","unresolved":false,"context_lines":[{"line_number":100,"context_line":"        self.samples \u003d os.path.dirname(os.path.abspath(__file__))"},{"line_number":101,"context_line":"        self.samples +\u003d os.path.sep + \u0027api_samples\u0027 + os.path.sep"},{"line_number":102,"context_line":"        if self.extension_name:"},{"line_number":103,"context_line":"            self.samples +\u003d self.extension_name + os.path.sep"},{"line_number":104,"context_line":""},{"line_number":105,"context_line":"    def _pretty_data(self, data):"},{"line_number":106,"context_line":"        if self.ctype \u003d\u003d \u0027json\u0027:"}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAALH%2F%2FrYc%3D","line":103,"updated":"2012-08-21 10:35:17.000000000","message":"os.path.join() is nicer than os.path.sep\n\nHow about:\n\n  @classmethod\n  def _get_sample(cls, name, suffix\u003d\u0027\u0027):\n      parts \u003d [os.path.dirname(os.path.abspath(__file__))]\n      parts.append(\u0027api_samples\u0027)\n      if cls.extension_name:\n          parts.append(cls.extension_name)\n      parts.append(name + \".\" + cls.ctype + suffix)\n      return os.path.join(*parts)\n\n  @classmethod\n  def _get_template(cls, name):\n      return cls._get_sample(name, suffix\u003d\u0027.tpl\u0027)","commit_id":"29b30da94bc3d40a91789fe750c7c8058b10994e"},{"author":{"_account_id":1247,"name":"Mark McLoughlin","email":"markmc@redhat.com","username":"markmc"},"change_message_id":"3c7eeea10eacf4dfed03129d4e344a849b8c9f33","unresolved":false,"context_lines":[{"line_number":140,"context_line":"            self.fail(\u0027Number of lines (%s) incorrect\u0027 % (len(expected_lines)))"},{"line_number":141,"context_line":"        result \u003d None"},{"line_number":142,"context_line":"        for i, line in enumerate(expected_lines):"},{"line_number":143,"context_line":"            result_line \u003d result_lines[i]"},{"line_number":144,"context_line":"            try:"},{"line_number":145,"context_line":"                match \u003d re.match(line, result_line)"},{"line_number":146,"context_line":"            except Exception as exc:"}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAALH%2F%2FrYQ%3D","line":143,"updated":"2012-08-21 10:35:17.000000000","message":"zip() works nicely here:\n\n  for line, result_line in zip(expected_lines, result_lines):\n      ...","commit_id":"29b30da94bc3d40a91789fe750c7c8058b10994e"},{"author":{"_account_id":1247,"name":"Mark McLoughlin","email":"markmc@redhat.com","username":"markmc"},"change_message_id":"3c7eeea10eacf4dfed03129d4e344a849b8c9f33","unresolved":false,"context_lines":[{"line_number":146,"context_line":"            except Exception as exc:"},{"line_number":147,"context_line":"                raise"},{"line_number":148,"context_line":"                self.fail(_(\u0027Response error on line %(i)s:\\n\u0027"},{"line_number":149,"context_line":"                          \u0027%(line)s\\n%(result_line)s\u0027) % locals())"},{"line_number":150,"context_line":"            if not match:"},{"line_number":151,"context_line":"                self.fail(_(\u0027Response error on line %(i)s:\\n\u0027"},{"line_number":152,"context_line":"                          \u0027%(line)s\\n%(result_line)s\u0027) % locals())"}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAALH%2F%2FrYM%3D","line":149,"updated":"2012-08-21 10:35:17.000000000","message":"unreachable line","commit_id":"29b30da94bc3d40a91789fe750c7c8058b10994e"},{"author":{"_account_id":1247,"name":"Mark McLoughlin","email":"markmc@redhat.com","username":"markmc"},"change_message_id":"3c7eeea10eacf4dfed03129d4e344a849b8c9f33","unresolved":false,"context_lines":[{"line_number":178,"context_line":"            method \u003d \u0027POST\u0027"},{"line_number":179,"context_line":"            body \u003d self._read_template(name) % subs"},{"line_number":180,"context_line":"            if FLAGS.generate_api_samples:"},{"line_number":181,"context_line":"                self._write_sample(name, self._pretty_data(body))"},{"line_number":182,"context_line":"        headers \u003d {}"},{"line_number":183,"context_line":"        headers[\u0027Content-Type\u0027] \u003d \u0027application/\u0027 + self.ctype"},{"line_number":184,"context_line":"        headers[\u0027Accept\u0027] \u003d \u0027application/\u0027 + self.ctype"}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAALH%2F%2FrXU%3D","line":181,"updated":"2012-08-21 10:35:17.000000000","message":"The POST vs GET handling is a bit noddy ... How about\n\n  def _get_response(self, url, method, body\u003dNone):\n      headers \u003d {}\n      ...\n      return self.api.api_request(...)\n\n  def _do_get(self, url):\n      return self._get_response(url, method\u003d\u0027GET\u0027)\n\n  def _do_post(self, url, name, subs):\n      body \u003d self._read_template(name) % subs\n      if FLAGS.generate_api_samples:\n          self._write_sample(name, self._pretty_data(body))\n      return self._get_response(url, method\u003d\u0027POST\u0027, body\u003dbody)","commit_id":"29b30da94bc3d40a91789fe750c7c8058b10994e"},{"author":{"_account_id":360,"name":"Dan Prince","email":"dprince@redhat.com","username":"dan-prince"},"change_message_id":"b77f93290b962375d571c58e70c451aab165cf43","unresolved":false,"context_lines":[{"line_number":28,"context_line":"FLAGS \u003d flags.FLAGS"},{"line_number":29,"context_line":"LOG \u003d logging.getLogger(__name__)"},{"line_number":30,"context_line":"# NOTE(vish): set this to true to regenerate the api samples"},{"line_number":31,"context_line":"GENERATE_SAMPLES \u003d False"},{"line_number":32,"context_line":""},{"line_number":33,"context_line":""},{"line_number":34,"context_line":"class ApiSampleTestBase(integrated_helpers._IntegratedTestBase):"}],"source_content_type":"text/x-python","patch_set":7,"id":"AAAALH%2F%2Fo%2B0%3D","line":31,"updated":"2012-08-23 19:34:53.000000000","message":"Would making this an environment variable work better? Seems like editing this file and running the test could lead to someone accidentally checking in a True value in the future?","commit_id":"10a29c6743a158768896c0072b441bfd8cef6119"}]}
