예제 #1
0
 def test_github_path_download(self, download_file):
     """Map github repository path to URL and download by url"""
     download_file.return_value = os.path.join(
        BLUEPRINTS_DIR,
        'cloudify-hello-world-example-master.zip'
     )
     download_file.side_effect = None
     blueprint_path = blueprint.get(
         'cloudify-cosmo/cloudify-hello-world-example',
         'openstack-blueprint.yaml',
         download=True
     )
     self.addCleanup(
         shutil.rmtree,
         os.path.dirname(os.path.dirname(blueprint_path))
     )
     self.assertThat(
         blueprint_path,
         EndsWith(
             'cloudify-hello-world-example-master/openstack-blueprint.yaml'
         ),
     )
     self.assertEqual(download_file.call_count, 1)
     self.assertIn(
         'https://github.com/cloudify-cosmo/'
         'cloudify-hello-world-example/archive/master.tar.gz',
         download_file.call_args.args
     )
예제 #2
0
 def test_github_path_custom_name(self):
     """Map github repository path to URL and ignore custom name."""
     self.assertThat(
         blueprint.get('cloudify-cosmo/cloudify-hello-world-example',
                       'ec2-blueprint.yaml'),
         Equals('https://github.com/cloudify-cosmo/'
                'cloudify-hello-world-example/archive/master.tar.gz'),
     )
예제 #3
0
 def test_github_path(self):
     """Map github repository path to URL."""
     # Can't check the whole path here, as it's a randomly generated temp
     self.assertThat(
         blueprint.get('cloudify-cosmo/cloudify-hello-world-example'),
         Equals('https://github.com/cloudify-cosmo/'
                'cloudify-hello-world-example/archive/master.tar.gz'),
     )
예제 #4
0
 def test_archive_custom_name(self, extract_archive, listdir, isfile):
     """Get a blueprint with a custom name from a zip file."""
     extract_archive.return_value = '/tmp'
     listdir.return_value = ['directory']
     isfile.return_value = True
     self.assertThat(
         blueprint.get(SAMPLE_CUSTOM_NAME_ARCHIVE, 'simple_blueprint.yaml'),
         Equals('/tmp/directory/simple_blueprint.yaml'),
     )
예제 #5
0
 def test_archive_default_name(self, extract_archive, listdir, isfile):
     """Get a blueprint from a zip file."""
     extract_archive.return_value = '/tmp'
     listdir.return_value = ['directory']
     isfile.return_value = True
     self.assertThat(
         blueprint.get(SAMPLE_ARCHIVE_PATH),
         Equals('/tmp/directory/blueprint.yaml'),
     )
예제 #6
0
 def test_archive_custom_name(self, extract_archive, listdir, isfile):
     """Get a blueprint with a custom name from a zip file."""
     extract_archive.return_value = '/tmp'
     listdir.return_value = ['directory']
     isfile.return_value = True
     self.assertThat(
         blueprint.get(SAMPLE_CUSTOM_NAME_ARCHIVE, 'simple_blueprint.yaml'),
         Equals('/tmp/directory/simple_blueprint.yaml'),
     )
예제 #7
0
 def test_archive_default_name(self, extract_archive, listdir, isfile):
     """Get a blueprint from a zip file."""
     extract_archive.return_value = '/tmp'
     listdir.return_value = ['directory']
     isfile.return_value = True
     self.assertThat(
         blueprint.get(SAMPLE_ARCHIVE_PATH),
         Equals('/tmp/directory/blueprint.yaml'),
     )
예제 #8
0
 def test_github_path(self):
     """Map github repository path to URL."""
     # Can't check the whole path here, as it's a randomly generated temp
     self.assertThat(
         blueprint.get('cloudify-cosmo/cloudify-hello-world-example'),
         Equals(
             'https://github.com/cloudify-cosmo/'
             'cloudify-hello-world-example/archive/master.tar.gz'
         ),
     )
예제 #9
0
 def test_github_path_custom_name(self):
     """Map github repository path to URL and ignore custom name."""
     self.assertThat(
         blueprint.get(
             'cloudify-cosmo/cloudify-hello-world-example',
             'ec2-blueprint.yaml'
         ),
         Equals(
             'https://github.com/cloudify-cosmo/'
             'cloudify-hello-world-example/archive/master.tar.gz'
         ),
     )
예제 #10
0
 def test_url_custom_name(self):
     """Ignore custom name in URL."""
     self.assertThat(
         blueprint.get(SAMPLE_ARCHIVE_URL, 'ec2-blueprint.yaml'),
         Equals(SAMPLE_ARCHIVE_URL),
     )
예제 #11
0
 def test_url_default_name(self):
     """Skip URL download."""
     self.assertThat(
         blueprint.get(SAMPLE_ARCHIVE_URL),
         Equals(SAMPLE_ARCHIVE_URL),
     )
예제 #12
0
 def test_yaml_path(self):
     """Get a blueprint from a yaml file."""
     self.assertThat(
         blueprint.get(SAMPLE_BLUEPRINT_PATH),
         Equals(SAMPLE_BLUEPRINT_PATH),
     )
예제 #13
0
 def test_url_custom_name(self):
     """Ignore custom name in URL."""
     self.assertThat(
         blueprint.get(SAMPLE_ARCHIVE_URL, 'ec2-blueprint.yaml'),
         Equals(SAMPLE_ARCHIVE_URL),
     )
예제 #14
0
 def test_url_default_name(self):
     """Skip URL download."""
     self.assertThat(
         blueprint.get(SAMPLE_ARCHIVE_URL),
         Equals(SAMPLE_ARCHIVE_URL),
     )
예제 #15
0
 def test_yaml_path(self):
     """Get a blueprint from a yaml file."""
     self.assertThat(
         blueprint.get(SAMPLE_BLUEPRINT_PATH),
         Equals(SAMPLE_BLUEPRINT_PATH),
     )