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

        response = {"type": "task_assignment",
                    "id": 123,
                    "message": "All good !!!",
                    "resolution_state": "completed",
                    "assigned_to": {"type": "user",
                                    "id": 123,
                                    "login": "******"},
                    "item": {"type": "task",
                             "id": 123}
        }

        expected_data = {"resolution_state": "completed",
                         "message": "All good !!!"}

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

        changed = client.update_assignment(123, "completed", "All good !!!")
        self.assertEquals(changed, response)