def setUpClass(self): """Setting up the globalization pipeline for testing""" acc = common.get_admin_gpserviceaccount() client = GPClient(acc) try: client.delete_bundle(common.bundleId1) client.delete_bundle(common.bundleId2) data = {} data['sourceLanguage'] = "en" data['targetLanguages'] = ["fr", "es-mx"] data['notes'] = ["string"] data['metadata'] = {} data['partner'] = '' data['segmentSeparatorPattern'] = 'string' data['noTranslationPattern'] = 'string' client.create_bundle(common.bundleId1, data=data) bundle1_entries = {} bundle1_entries['greet'] = "Hello" bundle1_entries['weather'] = "It is snowing" client.upload_resource_entries(common.bundleId1, "en", data=bundle1_entries) client.create_bundle(common.bundleId2, data=data) bundle2_entries = {} bundle2_entries['exit'] = "Goodbye" bundle2_entries['show'] = "The Wire" client.upload_resource_entries(common.bundleId2, "en", data=bundle2_entries) except: pass
def test_delete_bundle_success(self): """Test to delete a specific bundle which exists""" acc = common.get_admin_gpserviceaccount() client = GPClient(acc) tresp = client.delete_bundle("test-bundle") common.my_assert_equal(self, "SUCCESS", tresp["status"], 'bundle could not be deleted')
def test_delete_bundle_fail(self): """Test to delete a specific bundle which doesn't exist""" acc = common.get_admin_gpserviceaccount() client = GPClient(acc) tresp = client.delete_bundle("test-bundle-notexists") common.my_assert_equal( self, "ERROR", tresp["status"], 'a bundle which does not exist can not be deleted')