Example #1
0
    def test_add_comment_to_comment(self):
        client = BoxClient("my_token")

        response = {"type": "comment",
                    "id": 123,
                    "item": {"id": 123,
                             "type": "comment"},
                    "message": "test"
        }

        expected_data={"item": {"type": "comment",
                                "id": 123},
                       "message": "test"
        }

        (flexmock(requests)
            .should_receive('request')
            .with_args("post",
                 "https://api.box.com/2.0/comments",
                 params=None,
                 data=json.dumps(expected_data),
                 headers=client.default_headers)
        .and_return(mocked_response(response)))

        comment = client.add_comment(123, "comment", "test")
        self.assertEquals(comment, response)