Пример #1
0
    def create_model(self):
        """Create a Model object."""
        unit_name = 'myapp/0'
        patcher = patch.dict(os.environ, {'JUJU_UNIT_NAME': unit_name})
        patcher.start()
        self.addCleanup(patcher.stop)

        backend = _ModelBackend()
        meta = CharmMeta()
        model = Model('myapp/0', meta, backend)
        return model
Пример #2
0
 def create_framework(self):
     model = Model(self.meta, _ModelBackend('local/0'))
     framework = Framework(self.tmpdir / "framework.data", self.tmpdir,
                           self.meta, model)
     self.addCleanup(framework.close)
     return framework
Пример #3
0
 def create_model(self):
     """Create a Model object."""
     backend = _ModelBackend(unit_name='myapp/0')
     meta = CharmMeta()
     model = Model(meta, backend)
     return model
Пример #4
0
 def create_framework(self):
     model = Model(self.meta, _ModelBackend('local/0'))
     framework = Framework(SQLiteStorage(':memory:'), self.tmpdir,
                           self.meta, model)
     self.addCleanup(framework.close)
     return framework