def create_web(context): web_prefix = str(randint(0, 100)) creation_info = WebCreationInformation() creation_info.Url = "workspace" + web_prefix creation_info.Title = "Workspace" new_web = context.web.webs.add(creation_info) context.execute_query() print("Web site {0} has been created".format(new_web.properties['ServerRelativeUrl'])) return new_web
def test5_can_create_web(self): target_web_name = "workspace_" + str(randint(0, 100000)) creation_info = WebCreationInformation() creation_info.Url = target_web_name creation_info.Title = target_web_name self.__class__.target_web = self.client.web.webs.add(creation_info) self.client.execute_query() results = self.client.web.webs.filter("Title eq '{0}'".format(target_web_name)) self.client.load(results) self.client.execute_query() self.assertEqual(len(results), 1) self.assertIsNotNone(results[0].resource_path)
def test_1_can_create_web(self): self.context.execute_query() # force to clear the pending queue target_web_name = "workspace_" + str(randint(0, 100000)) creation_info = WebCreationInformation() creation_info.Url = target_web_name creation_info.Title = target_web_name self.__class__.target_web = self.context.web.webs.add(creation_info) self.context.execute_query() results = self.context.web.webs.filter("Title eq '{0}'".format(target_web_name)) self.context.load(results) self.context.execute_query() self.assertEqual(len(results), 1) self.assertIsNotNone(results[0].url)