def test_repo_create(self):
     application_map = loader.load_service_definitions(
         self.service_directory)
     self.vcs.client = TestGitHubClient(application_map)
     loader.walk_service_map(application_map,
                             application_callback=None,
                             service_callback=self.validate_create)
Exemplo n.º 2
0
 def test_service_definition_generation(self):
     service_directory = os.path.join(testcase_parent.DIRNAME, '../resources/initializer_test')
     application_map = loader.load_service_definitions(service_directory)
     init = Initializer(self.vcs, self.temp_dir, True, self.service_templates_test)
     init.code_generator.get_default_code_creator().dry_run = False
     init.initialize_services(application_map)
     loader.walk_service_map(application_map, application_callback=None,
                             service_callback=self.validate_service_generation)
 def test_repo_exists(self):
     application_map = loader.load_service_definitions(
         self.service_directory)
     loader.walk_service_map(application_map,
                             application_callback=None,
                             service_callback=self.validate_exists)
     self.vcs.client = None
     self.vcs.dry_run = True
     loader.walk_service_map(application_map,
                             application_callback=None,
                             service_callback=self.validate_exists)
     self.vcs.client = "TestClient"
Exemplo n.º 4
0
 def __init__(self, filter_string, service_filter_string, service_directory,
              destination_directory, dry_run):
     super(ServiceContext, self).__init__()
     self.destination_directory = destination_directory
     self.dry_run = dry_run
     if not os.path.exists(service_directory):
         logging.warn(
             "Service directory does not exist, not loading services or vcs - {}"
             .format(service_directory))
     else:
         self.application_map = loader.load_service_definitions(
             service_directory=service_directory,
             app_filter=filter_string,
             service_filter=service_filter_string)
         self.vcs = VCS(service_directory=service_directory,
                        dry_run=dry_run)
Exemplo n.º 5
0
 def test_vcs_init(self):
     try:
         vcs = VCS(self.bad_vcs, True)
         self.fail("Did not except")
     except Exception as E:
         self.assertTrue("vcs-config.json" in E.message)
     vcs = VCS(self.service_directory, True)
     self.assertTrue(vcs.default_provider == "bitbucket",
                     "Failed to load default provider")
     self.assertTrue(
         type(vcs_provider_map[vcs.default_provider]) ==
         BitbucketVCSProvider, "Failed to load default provider")
     application_map = loader.load_service_definitions(
         self.service_directory)
     vcs.validate_repositories(application_map=application_map)
     vcs.clone_service(application_map=application_map,
                       destination_directory="/tmp/out")
     for key, app in application_map.iteritems():
         for key, service in app.iteritems():
             vcs.init_repo(service, "/tmp/out/{}".format(key))
Exemplo n.º 6
0
 def test_project_init(self):
     application_map = loader.load_service_definitions(self.service_directory)
     init = Initializer(self.vcs, self.temp_dir, True, self.service_templates_test)
     init.code_generator.get_default_code_creator().dry_run = False
     init.initialize_services(application_map)
     loader.walk_service_map(application_map, application_callback=None, service_callback=self.validate_generation)