Example #1
0
    def test_get_app(self):
        """Test the _get_app method"""

        lkp = AppsLookupModule()
        app_path = "apps/learninglocker"

        app = lkp._get_app(app_path)
        self.assertEqual(app.get("name"), "learninglocker")
        self.assertEqual(len(app.get("services")), 4)
        self.assertEqual(len(app.get("vars")), 1)
        self.assertEqual(len(app.get("volumes")), 1)
        self.assertEqual(len(app.get("settings")), 2)
Example #2
0
    def test_get_app_without_tray_file(self):
        """Test the _get_app method for an app with no tray.yml file"""

        # Create a hello app with no tray.yml file
        app_files = (
            ("apps/hello/templates/services/app/dc.yml.j2", ""),
            ("apps/hello/templates/services/app/route.yml.j2", ""),
            ("apps/hello/templates/services/app/svc.yml.j2", ""),
            ("apps/hello/vars/all/main.yml", ""),
        )
        for file_path, file_content in app_files:
            self.fs.create_file(file_path, contents=file_content)

        lkp = AppsLookupModule()
        app_path = "apps/hello"

        app = lkp._get_app(app_path)
        self.assertEqual(app, None)