Esempio n. 1
0
 def test_from_dict(self):
     project = Project.from_dicts(
         "figtest", [{"name": "web", "image": "ubuntu"}, {"name": "db", "image": "ubuntu"}], self.client
     )
     self.assertEqual(len(project.services), 2)
     self.assertEqual(project.get_service("web").name, "web")
     self.assertEqual(project.get_service("web").options["image"], "ubuntu")
     self.assertEqual(project.get_service("db").name, "db")
     self.assertEqual(project.get_service("db").options["image"], "ubuntu")
Esempio n. 2
0
    def test_from_dict_sorts_in_dependency_order(self):
        project = Project.from_dicts(
            "figtest",
            [{"name": "web", "image": "ubuntu", "links": ["db"]}, {"name": "db", "image": "ubuntu"}],
            self.client,
        )

        self.assertEqual(project.services[0].name, "db")
        self.assertEqual(project.services[1].name, "web")
Esempio n. 3
0
    def test_from_dict_sorts_in_dependency_order(self):
        project = Project.from_dicts('figtest', [{
            'name': 'web',
            'image': 'ubuntu',
            'links': ['db'],
        }, {
            'name': 'db',
            'image': 'ubuntu'
        }], self.client)

        self.assertEqual(project.services[0].name, 'db')
        self.assertEqual(project.services[1].name, 'web')
Esempio n. 4
0
 def test_from_dict(self):
     project = Project.from_dicts('figtest', [{
         'name': 'web',
         'image': 'ubuntu'
     }, {
         'name': 'db',
         'image': 'ubuntu'
     }], self.client)
     self.assertEqual(len(project.services), 2)
     self.assertEqual(project.get_service('web').name, 'web')
     self.assertEqual(project.get_service('web').options['image'], 'ubuntu')
     self.assertEqual(project.get_service('db').name, 'db')
     self.assertEqual(project.get_service('db').options['image'], 'ubuntu')
Esempio n. 5
0
    def test_from_dict_sorts_in_dependency_order(self):
        project = Project.from_dicts('figtest', [
            {
                'name': 'web',
                'image': 'ubuntu',
                'links': ['db'],
            },
            {
                'name': 'db',
                'image': 'ubuntu'
            }
        ], self.client)

        self.assertEqual(project.services[0].name, 'db')
        self.assertEqual(project.services[1].name, 'web')
Esempio n. 6
0
 def test_from_dict(self):
     project = Project.from_dicts('figtest', [
         {
             'name': 'web',
             'image': 'ubuntu'
         },
         {
             'name': 'db',
             'image': 'ubuntu'
         }
     ], self.client)
     self.assertEqual(len(project.services), 2)
     self.assertEqual(project.get_service('web').name, 'web')
     self.assertEqual(project.get_service('web').options['image'], 'ubuntu')
     self.assertEqual(project.get_service('db').name, 'db')
     self.assertEqual(project.get_service('db').options['image'], 'ubuntu')
Esempio n. 7
0
 def test_from_dict(self):
     project = Project.from_dicts('figtest', [
         {
             'name': 'web',
             'image': 'busybox:latest'
         },
         {
             'name': 'db',
             'image': 'busybox:latest'
         },
     ], None)
     self.assertEqual(len(project.services), 2)
     self.assertEqual(project.get_service('web').name, 'web')
     self.assertEqual(project.get_service('web').options['image'], 'busybox:latest')
     self.assertEqual(project.get_service('db').name, 'db')
     self.assertEqual(project.get_service('db').options['image'], 'busybox:latest')
Esempio n. 8
0
 def test_from_dict(self):
     project = Project.from_dicts('figtest', [
         {
             'name': 'web',
             'image': 'busybox:latest'
         },
         {
             'name': 'db',
             'image': 'busybox:latest'
         },
     ], None)
     self.assertEqual(len(project.services), 2)
     self.assertEqual(project.get_service('web').name, 'web')
     self.assertEqual(
         project.get_service('web').options['image'], 'busybox:latest')
     self.assertEqual(project.get_service('db').name, 'db')
     self.assertEqual(
         project.get_service('db').options['image'], 'busybox:latest')
Esempio n. 9
0
    def test_from_dict_sorts_in_dependency_order(self):
        project = Project.from_dicts('figtest', [{
            'name': 'web',
            'image': 'busybox:latest',
            'links': ['db'],
        }, {
            'name': 'db',
            'image': 'busybox:latest',
            'volumes_from': ['volume']
        }, {
            'name': 'volume',
            'image': 'busybox:latest',
            'volumes': ['/tmp'],
        }], None)

        self.assertEqual(project.services[0].name, 'volume')
        self.assertEqual(project.services[1].name, 'db')
        self.assertEqual(project.services[2].name, 'web')
Esempio n. 10
0
    def test_from_dict_sorts_in_dependency_order(self):
        project = Project.from_dicts('figtest', [
            {
                'name': 'web',
                'image': 'busybox:latest',
                'links': ['db'],
            },
            {
                'name': 'db',
                'image': 'busybox:latest',
                'volumes_from': ['volume']
            },
            {
                'name': 'volume',
                'image': 'busybox:latest',
                'volumes': ['/tmp'],
            }
        ], None)

        self.assertEqual(project.services[0].name, 'volume')
        self.assertEqual(project.services[1].name, 'db')
        self.assertEqual(project.services[2].name, 'web')
Esempio n. 11
0
 def to_fig_project(self, client):
     return Project.from_dicts(self.plan.name, self.to_service_dicts, client)