def test_simple_clone_success(self): CALL_ID_CREATE = 0 CALL_ID_CLONE = 1 repository = dict(self.repo_server_data) repository['status'] = 'CREATED' self.conn.set_responses( Response.with_json(status_code=201, json={'repository': repository}), Response.ok()) sap.rest.gcts.simple_clone(self.conn, self.repo_url, self.repo_name, vcs_token='THE_TOKEN') data = dict(self.repo_data) data['config'] = [{ 'key': 'VCS_TARGET_DIR', 'value': 'src/' }, { 'key': 'CLIENT_VCS_AUTH_TOKEN', 'value': 'THE_TOKEN' }] request_load = {'repository': self.repo_name, 'data': data} self.assertEqual(len(self.conn.execs), 2) self.conn.execs[CALL_ID_CREATE].assertEqual(Request.post_json( uri='repository', body=request_load, accept='application/json'), self, json_body=True) self.conn.execs[CALL_ID_CLONE].assertEqual( Request.post(uri=f'repository/{self.repo_name}/clone'), self)
def test_service_published(self): connection = sample_connection_ok() service_name = 'TEST_SERVICE_2' binding_name = 'TEST_BINDING' binding = sap.adt.businessservice.ServiceBinding(connection, binding_name) binding.fetch() status = binding.publish(binding.services[1]) connection.execs[1].assertEqual( Request.post( uri='/sap/bc/adt/businessservices/odatav2/publishjobs', headers={ 'Accept': 'application/xml, application/vnd.sap.as+xml;charset=UTF-8;dataname=com.sap.adt.StatusMessage', 'Content-Type': 'application/xml' }, params={ 'servicename': 'TEST_BINDING', 'serviceversion': '0002' }, body=SAMPLE_BINDING_OBJECT_REFERENCE ), self ) self.assertEqual(status.SEVERITY, "OK") self.assertEqual(status.SHORT_TEXT, "Local Service Endpoint of service TEST_SERVICE_2 with version 0002 is activated locally") self.assertEqual(status.LONG_TEXT, "")
def test_clone_ok(self): repo = sap.rest.gcts.Repository(self.conn, self.repo_name, data=self.repo_server_data) repo.clone() self.assertIsNone(repo._data) self.assertEqual(len(self.conn.execs), 1) self.conn.execs[0].assertEqual( Request.post(uri=f'repository/{self.repo_name}/clone'), self)
def request_for_cts_task(self, task): return Request.post( f'/sap/bc/adt/cts/transportrequests/{task.number}/newreleasejobs', accept='application/vnd.sap.adt.transportorganizer.v1+xml')