def test_create_task(self): self.connection.set_responses( Response(status_code=201, text=TASK_CREATE_OK_RESPONSE)) self.task_1._number = None self.task_1._transport = self.transport.number self.task_1.create() self.maxDiff = None self.assertEqual(len(self.connection.execs), 1) self.connection.execs[0].assertEqual(Request.post_text( uri= f'/sap/bc/adt/cts/transportrequests/{self.task_1.transport}/tasks', accept='application/vnd.sap.adt.transportorganizer.v1+xml', body=f'''<?xml version="1.0" encoding="ASCII"?> <tm:root xmlns:tm="http://www.sap.com/cts/adt/tm" tm:number="{self.task_1.transport}" tm:targetuser="******" tm:useraction="newtask"/> '''), asserter=self) self.assertEqual(self.task_1.number, TASK_NUMBER)
def test_create_transport(self): self.connection.set_responses( Response(status_code=201, text=TRANSPORT_CREATE_OK_RESPONSE)) self.transport._number = None self.transport.create() self.maxDiff = None self.assertEqual(self.connection.execs, [ Request.post_text( uri='/sap/bc/adt/cts/transportrequests', accept='application/vnd.sap.adt.transportorganizer.v1+xml', body=f'''<?xml version="1.0" encoding="UTF-8"?> <tm:root xmlns:tm="http://www.sap.com/cts/adt/tm" tm:useraction="newrequest"> <tm:request tm:desc="{self.transport.description}" tm:type="K" tm:target="{self.transport.target}" tm:cts_project=""> <tm:task tm:owner="{self.transport.owner}"/> </tm:request> </tm:root> ''') ]) self.assertEqual(self.transport.number, TRANSPORT_NUMBER)