)]}'
{"kuryr_kubernetes/tests/unit/controller/handlers/test_lbaas.py":[{"author":{"_account_id":22348,"name":"Zuul","username":"zuul","tags":["SERVICE_USER"]},"tag":"autogenerated:zuul:check","change_message_id":"153ddc137ef8774d624c00fdc8b0a22134fa4f9a","unresolved":false,"context_lines":[{"line_number":352,"context_line":"                      \"implemented\")"},{"line_number":353,"context_line":""},{"line_number":354,"context_line":"    def test_has_spec(self):"},{"line_number":355,"context_line":"        m_handler \u003d mock.Mock(spec\u003d(endpoints[\u0027metadata\u0027][\u0027annotations\u0027]"},{"line_number":356,"context_line":"                                    [k_const.K8S_ANNOTATION_LBAAS_SPEC]))"},{"line_number":357,"context_line":"        m_handler._has_spec.return_value \u003d True"},{"line_number":358,"context_line":"        ret \u003d m_handler._move_annotations_to_crd"}],"source_content_type":"text/x-python","patch_set":1,"id":"1f621f24_32e9301a","line":355,"updated":"2020-10-31 10:02:40.000000000","message":"pep8: F821 undefined name \u0027endpoints\u0027","commit_id":"b3d6d15145870bbada4084ecb7164aba2c37f76e"},{"author":{"_account_id":22348,"name":"Zuul","username":"zuul","tags":["SERVICE_USER"]},"tag":"autogenerated:zuul:check","change_message_id":"153ddc137ef8774d624c00fdc8b0a22134fa4f9a","unresolved":false,"context_lines":[{"line_number":353,"context_line":""},{"line_number":354,"context_line":"    def test_has_spec(self):"},{"line_number":355,"context_line":"        m_handler \u003d mock.Mock(spec\u003d(endpoints[\u0027metadata\u0027][\u0027annotations\u0027]"},{"line_number":356,"context_line":"                                    [k_const.K8S_ANNOTATION_LBAAS_SPEC]))"},{"line_number":357,"context_line":"        m_handler._has_spec.return_value \u003d True"},{"line_number":358,"context_line":"        ret \u003d m_handler._move_annotations_to_crd"},{"line_number":359,"context_line":"        self.assertTrue(ret)"}],"source_content_type":"text/x-python","patch_set":1,"id":"1f621f24_12eeb421","line":356,"updated":"2020-10-31 10:02:40.000000000","message":"pep8: F821 undefined name \u0027k_const\u0027","commit_id":"b3d6d15145870bbada4084ecb7164aba2c37f76e"},{"author":{"_account_id":22348,"name":"Zuul","username":"zuul","tags":["SERVICE_USER"]},"tag":"autogenerated:zuul:check","change_message_id":"153ddc137ef8774d624c00fdc8b0a22134fa4f9a","unresolved":false,"context_lines":[{"line_number":359,"context_line":"        self.assertTrue(ret)"},{"line_number":360,"context_line":""},{"line_number":361,"context_line":"    def test_has_state(self):"},{"line_number":362,"context_line":"        m_handler \u003d mock.Mock(spec\u003d(endpoints[\u0027metadata\u0027][\u0027annotations\u0027]"},{"line_number":363,"context_line":"                                    [k_const.K8S_ANNOTATION_LBAAS_STATE]))"},{"line_number":364,"context_line":"        m_handler._has_state.return_value \u003d True"},{"line_number":365,"context_line":"        ret \u003d m_handler._move_annotations_to_crd"}],"source_content_type":"text/x-python","patch_set":1,"id":"1f621f24_72f3a80b","line":362,"updated":"2020-10-31 10:02:40.000000000","message":"pep8: F821 undefined name \u0027endpoints\u0027","commit_id":"b3d6d15145870bbada4084ecb7164aba2c37f76e"},{"author":{"_account_id":22348,"name":"Zuul","username":"zuul","tags":["SERVICE_USER"]},"tag":"autogenerated:zuul:check","change_message_id":"153ddc137ef8774d624c00fdc8b0a22134fa4f9a","unresolved":false,"context_lines":[{"line_number":360,"context_line":""},{"line_number":361,"context_line":"    def test_has_state(self):"},{"line_number":362,"context_line":"        m_handler \u003d mock.Mock(spec\u003d(endpoints[\u0027metadata\u0027][\u0027annotations\u0027]"},{"line_number":363,"context_line":"                                    [k_const.K8S_ANNOTATION_LBAAS_STATE]))"},{"line_number":364,"context_line":"        m_handler._has_state.return_value \u003d True"},{"line_number":365,"context_line":"        ret \u003d m_handler._move_annotations_to_crd"},{"line_number":366,"context_line":"        self.assertTrue(ret)"}],"source_content_type":"text/x-python","patch_set":1,"id":"1f621f24_52f82ce4","line":363,"updated":"2020-10-31 10:02:40.000000000","message":"pep8: F821 undefined name \u0027k_const\u0027","commit_id":"b3d6d15145870bbada4084ecb7164aba2c37f76e"},{"author":{"_account_id":22348,"name":"Zuul","username":"zuul","tags":["SERVICE_USER"]},"tag":"autogenerated:zuul:check","change_message_id":"153ddc137ef8774d624c00fdc8b0a22134fa4f9a","unresolved":false,"context_lines":[{"line_number":366,"context_line":"        self.assertTrue(ret)"},{"line_number":367,"context_line":""},{"line_number":368,"context_line":"    def test_has_no_annotations(self):"},{"line_number":369,"context_line":"        has_spec \u003d mock.Mock(spec\u003d(endpoints[\u0027metadata\u0027][\u0027annotations\u0027]"},{"line_number":370,"context_line":"                                   [k_const.K8S_ANNOTATION_LBAAS_SPEC]))"},{"line_number":371,"context_line":"        has_state \u003d mock.Mock(state\u003d(endpoints[\u0027metadata\u0027][\u0027annotations\u0027]"},{"line_number":372,"context_line":"                                     [k_const.K8S_ANNOTATION_LBAAS_STATE]))"}],"source_content_type":"text/x-python","patch_set":1,"id":"1f621f24_b2dc2075","line":369,"updated":"2020-10-31 10:02:40.000000000","message":"pep8: F821 undefined name \u0027endpoints\u0027","commit_id":"b3d6d15145870bbada4084ecb7164aba2c37f76e"},{"author":{"_account_id":22348,"name":"Zuul","username":"zuul","tags":["SERVICE_USER"]},"tag":"autogenerated:zuul:check","change_message_id":"153ddc137ef8774d624c00fdc8b0a22134fa4f9a","unresolved":false,"context_lines":[{"line_number":367,"context_line":""},{"line_number":368,"context_line":"    def test_has_no_annotations(self):"},{"line_number":369,"context_line":"        has_spec \u003d mock.Mock(spec\u003d(endpoints[\u0027metadata\u0027][\u0027annotations\u0027]"},{"line_number":370,"context_line":"                                   [k_const.K8S_ANNOTATION_LBAAS_SPEC]))"},{"line_number":371,"context_line":"        has_state \u003d mock.Mock(state\u003d(endpoints[\u0027metadata\u0027][\u0027annotations\u0027]"},{"line_number":372,"context_line":"                                     [k_const.K8S_ANNOTATION_LBAAS_STATE]))"},{"line_number":373,"context_line":"        m_handler \u003d not(has_spec or has_state)"}],"source_content_type":"text/x-python","patch_set":1,"id":"1f621f24_92d92485","line":370,"updated":"2020-10-31 10:02:40.000000000","message":"pep8: F821 undefined name \u0027k_const\u0027","commit_id":"b3d6d15145870bbada4084ecb7164aba2c37f76e"},{"author":{"_account_id":22348,"name":"Zuul","username":"zuul","tags":["SERVICE_USER"]},"tag":"autogenerated:zuul:check","change_message_id":"153ddc137ef8774d624c00fdc8b0a22134fa4f9a","unresolved":false,"context_lines":[{"line_number":368,"context_line":"    def test_has_no_annotations(self):"},{"line_number":369,"context_line":"        has_spec \u003d mock.Mock(spec\u003d(endpoints[\u0027metadata\u0027][\u0027annotations\u0027]"},{"line_number":370,"context_line":"                                   [k_const.K8S_ANNOTATION_LBAAS_SPEC]))"},{"line_number":371,"context_line":"        has_state \u003d mock.Mock(state\u003d(endpoints[\u0027metadata\u0027][\u0027annotations\u0027]"},{"line_number":372,"context_line":"                                     [k_const.K8S_ANNOTATION_LBAAS_STATE]))"},{"line_number":373,"context_line":"        m_handler \u003d not(has_spec or has_state)"},{"line_number":374,"context_line":"        m_handler.return_value \u003d False"}],"source_content_type":"text/x-python","patch_set":1,"id":"1f621f24_f2e69844","line":371,"updated":"2020-10-31 10:02:40.000000000","message":"pep8: F821 undefined name \u0027endpoints\u0027","commit_id":"b3d6d15145870bbada4084ecb7164aba2c37f76e"},{"author":{"_account_id":22348,"name":"Zuul","username":"zuul","tags":["SERVICE_USER"]},"tag":"autogenerated:zuul:check","change_message_id":"153ddc137ef8774d624c00fdc8b0a22134fa4f9a","unresolved":false,"context_lines":[{"line_number":369,"context_line":"        has_spec \u003d mock.Mock(spec\u003d(endpoints[\u0027metadata\u0027][\u0027annotations\u0027]"},{"line_number":370,"context_line":"                                   [k_const.K8S_ANNOTATION_LBAAS_SPEC]))"},{"line_number":371,"context_line":"        has_state \u003d mock.Mock(state\u003d(endpoints[\u0027metadata\u0027][\u0027annotations\u0027]"},{"line_number":372,"context_line":"                                     [k_const.K8S_ANNOTATION_LBAAS_STATE]))"},{"line_number":373,"context_line":"        m_handler \u003d not(has_spec or has_state)"},{"line_number":374,"context_line":"        m_handler.return_value \u003d False"},{"line_number":375,"context_line":"        ret \u003d m_handler._move_annotations_to_crd"}],"source_content_type":"text/x-python","patch_set":1,"id":"1f621f24_d2e39c32","line":372,"updated":"2020-10-31 10:02:40.000000000","message":"pep8: F821 undefined name \u0027k_const\u0027","commit_id":"b3d6d15145870bbada4084ecb7164aba2c37f76e"},{"author":{"_account_id":22348,"name":"Zuul","username":"zuul","tags":["SERVICE_USER"]},"tag":"autogenerated:zuul:check","change_message_id":"7c7b2fd063a5a10cc56749d190ceda64f0c76889","unresolved":false,"context_lines":[{"line_number":354,"context_line":"    def test_has_spec(self):"},{"line_number":355,"context_line":"        spec \u003d {"},{"line_number":356,"context_line":"            apiVersion: v1"},{"line_number":357,"context_line":"            kind: Endpoints"},{"line_number":358,"context_line":"            metadata:"},{"line_number":359,"context_line":"                annotations:"},{"line_number":360,"context_line":"                    openstack.org/kuryr-lbaas-spec:"}],"source_content_type":"text/x-python","patch_set":4,"id":"1f621f24_52d66cc7","line":357,"updated":"2020-10-31 14:02:57.000000000","message":"pep8: E999 SyntaxError: invalid syntax","commit_id":"3ba125e05ed282399157267c2848c0b57864d877"},{"author":{"_account_id":27032,"name":"Maysa de Macedo Souza","email":"maysa.macedo95@gmail.com","username":"maysa"},"change_message_id":"3ca91fa27b05cf7cb66e9b290c2e632ba6daffd9","unresolved":false,"context_lines":[{"line_number":352,"context_line":"                      \"implemented\")"},{"line_number":353,"context_line":""},{"line_number":354,"context_line":"    def test_has_spec(self):"},{"line_number":355,"context_line":"        spec \u003d {"},{"line_number":356,"context_line":"            apiVersion: v1"},{"line_number":357,"context_line":"            kind: Endpoints"},{"line_number":358,"context_line":"            metadata:"},{"line_number":359,"context_line":"                annotations:"},{"line_number":360,"context_line":"                    openstack.org/kuryr-lbaas-spec:"},{"line_number":361,"context_line":"                        \u0027{\"versioned_object.data\": {"},{"line_number":362,"context_line":"                            \"ip\": \"172.30.173.106\","},{"line_number":363,"context_line":"                            \"lb_ip\": null,"},{"line_number":364,"context_line":"                            \"ports\": [{\"versioned_object.data\": {"},{"line_number":365,"context_line":"                                \"name\": \"https\","},{"line_number":366,"context_line":"                                \"port\": 443,"},{"line_number":367,"context_line":"                                \"protocol\": \"TCP\","},{"line_number":368,"context_line":"                                \"targetPort\": \"8443\""},{"line_number":369,"context_line":"                                },"},{"line_number":370,"context_line":"                                \"versioned_object.name\": \"LBaaSPortSpec\","},{"line_number":371,"context_line":"                                \"versioned_object.namespace\":"},{"line_number":372,"context_line":"                                \"kuryr_kubernetes\","},{"line_number":373,"context_line":"                                \"versioned_object.version\": \"1.1\"}],"},{"line_number":374,"context_line":"                            \"project_id\": \"5479078154874c89b039cfee30fb2c1e\","},{"line_number":375,"context_line":"                            \"security_groups_ids\": ["},{"line_number":376,"context_line":"                                \"d8d31308-eb00-4199-a784-e329dc25814b\""},{"line_number":377,"context_line":"                                ],"},{"line_number":378,"context_line":"                            \"subnet_id\":"},{"line_number":379,"context_line":"                                \"c77a8802-8d94-4c08-a93d-049cf239754c\","},{"line_number":380,"context_line":"                            \"type\": \"ClusterIP\""},{"line_number":381,"context_line":"                            },"},{"line_number":382,"context_line":"                            \"versioned_object.name\": \"LBaaSServiceSpec\","},{"line_number":383,"context_line":"                            \"versioned_object.namespace\":"},{"line_number":384,"context_line":"                                \"kuryr_kubernetes\","},{"line_number":385,"context_line":"                            \"versioned_object.version\": \"1.0\"}\u0027"},{"line_number":386,"context_line":"        }"},{"line_number":387,"context_line":""},{"line_number":388,"context_line":"        m_handler \u003d spec"},{"line_number":389,"context_line":"        m_handler._has_spec.return_value \u003d True"}],"source_content_type":"text/x-python","patch_set":4,"id":"1f621f24_5c7af623","line":386,"range":{"start_line":355,"start_character":0,"end_line":386,"end_character":9},"updated":"2020-11-02 11:49:07.000000000","message":"Note that the key and values should have data types that are allowed on Python, like String.","commit_id":"3ba125e05ed282399157267c2848c0b57864d877"},{"author":{"_account_id":27032,"name":"Maysa de Macedo Souza","email":"maysa.macedo95@gmail.com","username":"maysa"},"change_message_id":"3ca91fa27b05cf7cb66e9b290c2e632ba6daffd9","unresolved":false,"context_lines":[{"line_number":385,"context_line":"                            \"versioned_object.version\": \"1.0\"}\u0027"},{"line_number":386,"context_line":"        }"},{"line_number":387,"context_line":""},{"line_number":388,"context_line":"        m_handler \u003d spec"},{"line_number":389,"context_line":"        m_handler._has_spec.return_value \u003d True"},{"line_number":390,"context_line":""},{"line_number":391,"context_line":"        ret \u003d m_handler._move_annotations_to_crd"}],"source_content_type":"text/x-python","patch_set":4,"id":"1f621f24_5cc83654","line":388,"range":{"start_line":388,"start_character":0,"end_line":388,"end_character":24},"updated":"2020-11-02 11:49:07.000000000","message":"You could mock the hole EndpointsHandler class as is done at line 315, and call the _move_annotations_to_crd method with the spec similarly to how is done at line 342.","commit_id":"3ba125e05ed282399157267c2848c0b57864d877"},{"author":{"_account_id":27032,"name":"Maysa de Macedo Souza","email":"maysa.macedo95@gmail.com","username":"maysa"},"change_message_id":"7ede5287cc3049858328d0f83a347395133ca8ee","unresolved":false,"context_lines":[{"line_number":353,"context_line":""},{"line_number":354,"context_line":"    def test_has_spec(self):"},{"line_number":355,"context_line":"        m_handler \u003d mock.Mock(spec\u003dh_lbaas.EndpointsHandler)"},{"line_number":356,"context_line":"        ret \u003d h_lbaas.EndpointsHandler._move_annotations_to_crd(m_handler)"},{"line_number":357,"context_line":"        self.assertTrue(ret)"},{"line_number":358,"context_line":""},{"line_number":359,"context_line":"    def test_has_state(self):"}],"source_content_type":"text/x-python","patch_set":5,"id":"1f621f24_7550a00b","line":356,"range":{"start_line":356,"start_character":14,"end_line":356,"end_character":74},"updated":"2020-11-02 18:01:23.000000000","message":"Note that this method also expects endpoints as parameter[1]. Also, the endpoint object used could be the same stated on the launchpad bug.\n\n[1] https://github.com/openstack/kuryr-kubernetes/blob/master/kuryr_kubernetes/controller/handlers/lbaas.py#L383\n\nWhat is difference between the testing methods? They look the same.\n\nAs mentioned on the bug the following scenarios could be tested:\n- check the _create_crd_spec is called when the state or spec is present on the Endpoint\n- check if no state or spec is present the _create_crd_spec is not called","commit_id":"cdf22533785cfa782aa7792f13230d5a81491db2"},{"author":{"_account_id":13692,"name":"Roman Dobosz","email":"gryf73@gmail.com","username":"gryf"},"change_message_id":"fc5327d044f603d140624960a58eefea190050bd","unresolved":false,"context_lines":[{"line_number":353,"context_line":""},{"line_number":354,"context_line":"    def test_has_spec(self):"},{"line_number":355,"context_line":"        m_handler \u003d mock.Mock(spec\u003dh_lbaas.EndpointsHandler)"},{"line_number":356,"context_line":"        ret \u003d h_lbaas.EndpointsHandler._move_annotations_to_crd(m_handler)"},{"line_number":357,"context_line":"        self.assertTrue(ret)"},{"line_number":358,"context_line":""},{"line_number":359,"context_line":"    def test_has_state(self):"}],"source_content_type":"text/x-python","patch_set":5,"id":"1f621f24_b863481a","line":356,"range":{"start_line":356,"start_character":14,"end_line":356,"end_character":74},"in_reply_to":"1f621f24_7550a00b","updated":"2020-11-03 07:22:27.000000000","message":"Also, as a general note. While functional tests (i.e. tempest) can test particular scenario, in unit tests we use to try to cover logic behind tested method.\n\nSo, in case of simple example:\n\n    class MyClass(object):\n\n        def __init__(self, arg):\n            self.attr \u003d arg\n\n        def method1(self, bar\u003d100):\n            if bar:\n                self.attr \u003d bar\n            else:\n                raise Exception(\"blah\")\n\n            return True\n\n\n    import unittest\n\n\n    class TestMyClass(unittest.TestCase):\n\n        def test_create_object(self):\n            obj \u003d MyClass(1)\n            self.assertEqual(obj.attr, 1)\n\n        def test_create_object_missing_attribute(self):\n            self.assertRaises(TypeError, MyClass)\n\n        def test_method1(self):\n            obj \u003d MyClass(1)\n            self.assertTrue(obj.method1(10))\n            self.assertEqual(obj.attr, 10)\n\n        def test_method1_negative(self):\n            obj \u003d MyClass(1)\n            self.assertTrue(obj.method1(-10))\n            self.assertEqual(obj.attr, -10)\n\n        def test_method1_zero(self):\n            obj \u003d MyClass(1)\n            self.assertRaises(Exception, obj.method1, 0)\n\nhere, we try to run tests against method \"method1\" with several different inputs - so the three independent tests. Note, that amount of test methods for single thing (creating object, calling method1 method) is at least twice, and it\u0027s increasing on tested method complexity.\n\nAlso. We usually name the test as the corresponding tested function/method, so in this case it should be \"test_move_annotation_to_crd\" (or, depending on the taste \"test__move_annotation_to_crd\", since this is a private method).","commit_id":"cdf22533785cfa782aa7792f13230d5a81491db2"},{"author":{"_account_id":23567,"name":"Luis Tomas Bolivar","email":"ltomasbo@redhat.com","username":"ltomasbo"},"change_message_id":"266209a1d5ece2bcd07ffb6d5c1a68b74facf732","unresolved":true,"context_lines":[{"line_number":368,"context_line":"            m_handler, endpoints)"},{"line_number":369,"context_line":"        self.assertTrue(ret)"},{"line_number":370,"context_line":""},{"line_number":371,"context_line":"    def test_move_annotations_to_crd_no_spec(self):"},{"line_number":372,"context_line":"        endpoints \u003d {"},{"line_number":373,"context_line":"            \"metadata\": {"},{"line_number":374,"context_line":"                \"annotations\": {"}],"source_content_type":"text/x-python","patch_set":6,"id":"34945a5f_40eadc74","line":371,"range":{"start_line":371,"start_character":0,"end_line":371,"end_character":2},"updated":"2020-12-16 07:46:36.000000000","message":"should we also test without state, not only without spec?","commit_id":"e84f1211ed16b39d573bea4d051a5d063802d79e"},{"author":{"_account_id":23567,"name":"Luis Tomas Bolivar","email":"ltomasbo@redhat.com","username":"ltomasbo"},"change_message_id":"266209a1d5ece2bcd07ffb6d5c1a68b74facf732","unresolved":true,"context_lines":[{"line_number":372,"context_line":"        endpoints \u003d {"},{"line_number":373,"context_line":"            \"metadata\": {"},{"line_number":374,"context_line":"                \"annotations\": {"},{"line_number":375,"context_line":"                    \"openstack.org/kuryr-lbaas-spec\": {},"},{"line_number":376,"context_line":"                    \"openstack.org/kuryr-lbaas-state\": {}"},{"line_number":377,"context_line":"                    },"},{"line_number":378,"context_line":"                \"manager\": \"python-requests\","}],"source_content_type":"text/x-python","patch_set":6,"id":"7e0e3913_ef37061f","line":375,"range":{"start_line":375,"start_character":1,"end_line":375,"end_character":57},"updated":"2020-12-16 07:46:36.000000000","message":"this has spec, right? shouldn\u0027t this be removed?","commit_id":"e84f1211ed16b39d573bea4d051a5d063802d79e"}]}
