def test_empty_manifest_should_raise_exception(self):
     manifest_file = os.path.join(os.path.dirname(__file__), '..', '..',
                                  '..', 'fixtures', 'operations',
                                  'manifest_empty.yml')
     self.assertRaises(
         AssertionError,
         lambda: ManifestReader.load_application_manifests(manifest_file))
 def test_complex_manifest_should_be_read(self):
     manifest_file = os.path.join(os.path.dirname(__file__), "..", "..",
                                  "..", "fixtures", "operations",
                                  "manifest_complex.yml")
     applications = ManifestReader.load_application_manifests(manifest_file)
     self.assertEqual(2, len(applications))
     self.assertEqual(
         dict(
             name="bigapp",
             buildpacks=["staticfile_buildpack"],
             memory=1024,
             path=os.path.abspath(
                 os.path.join(os.path.dirname(manifest_file), "big")),
         ),
         applications[0],
     )
     self.assertEqual(
         dict(
             name="smallapp",
             buildpacks=["staticfile_buildpack"],
             memory=256,
             path=os.path.abspath(
                 os.path.join(os.path.dirname(manifest_file), "small")),
         ),
         applications[1],
     )
Пример #3
0
    def push(self, space_id: str, manifest_path: str, restart: bool = True):
        app_manifests = ManifestReader.load_application_manifests(
            manifest_path)
        organization, space = self._retrieve_space_and_organization(space_id)

        for app_manifest in app_manifests:
            if 'path' in app_manifest or 'docker' in app_manifest:
                self._push_application(organization, space, app_manifest,
                                       restart)
 def test_manifest_should_be_read(self):
     manifest_file = os.path.join(os.path.dirname(__file__), '..', '..',
                                  '..', 'fixtures', 'operations',
                                  'manifest.yml')
     applications = ManifestReader.load_application_manifests(manifest_file)
     self.assertEqual(1, len(applications))
     self.assertEqual(
         dict(
             docker=dict(username='******',
                         password='******',
                         image='some-image'),
             name='the-name',
             routes=[dict(route='first-route'),
                     dict(route='second-route')]), applications[0])
 def test_manifest_should_be_read(self):
     manifest_file = os.path.join(os.path.dirname(__file__), "..", "..",
                                  "..", "fixtures", "operations",
                                  "manifest.yml")
     applications = ManifestReader.load_application_manifests(manifest_file)
     self.assertEqual(1, len(applications))
     self.assertEqual(
         dict(
             docker=dict(username="******",
                         password="******",
                         image="some-image"),
             name="the-name",
             routes=[dict(route="first-route"),
                     dict(route="second-route")],
         ),
         applications[0],
     )
 def test_complex_manifest_should_be_read(self):
     manifest_file = os.path.join(os.path.dirname(__file__), '..', '..',
                                  '..', 'fixtures', 'operations',
                                  'manifest_complex.yml')
     applications = ManifestReader.load_application_manifests(manifest_file)
     self.assertEqual(2, len(applications))
     self.assertEqual(
         dict(name='bigapp',
              buildpacks=['staticfile_buildpack'],
              memory=1024,
              path=os.path.abspath(
                  os.path.join(os.path.dirname(manifest_file), 'big'))),
         applications[0])
     self.assertEqual(
         dict(name='smallapp',
              buildpacks=['staticfile_buildpack'],
              memory=256,
              path=os.path.abspath(
                  os.path.join(os.path.dirname(manifest_file), 'small'))),
         applications[1])