def setUp(self): KVObject.backend = MockBackend({}) KVObject.config = configuration.Config(driver="") self.fixtures_dir = os.path.join(test_base, 'fixtures') schema_file = os.path.join(self.fixtures_dir, 'schema.yaml') self.schema = loader.Schema.from_file(schema_file) self.es = EntitySyncer('unicorn', self.schema.entities['unicorn'])
def setUp(self): KVObject.backend = MockBackend({}) KVObject.config = configuration.Config(driver="") self.base_defs = { 'tags': ['test', 'example'], 'schema': { 'astring': { 'type': 'string', 'default': 'foo' }, 'alist': { 'type': 'list', 'default': [] }, 'abool': { 'type': 'bool', 'default': False }, 'anenum': { 'type': 'enum:a|b|c|foo', 'default': 'foo' } }, 'path': 'example.org', }
def setUp(self): KVObject.backend = MockBackend({}) KVObject.config = configuration.Config(driver="") self.schema = loader.Schema.from_file( os.path.join(test_base, 'fixtures', 'dbconfig', 'schema.yaml')) self.instance = mock.MagicMock() self.section = mock.MagicMock() self.config = DbConfig(self.schema, self.instance, self.section) self.mwconfig = self.config.entity self.restore_path = os.path.join(test_base, 'fixtures', 'dbconfig', 'restore')
def setUp(self): KVObject.backend = MockBackend({}) KVObject.config = configuration.Config(driver="") self.schema = loader.Schema.from_file( os.path.join(test_base, 'fixtures', 'dbconfig', 'schema.yaml')) checker = mock.MagicMock() checker.return_value = [] self.section = Section(self.schema, checker) obj = self.section.entity('extra', 'x1') obj.master = 'db1' obj.min_replicas = 3 obj.write = mock.MagicMock() self.section.get = mock.MagicMock(return_value=obj)
def setup_method(self): """Setup a Confctl instance with a mocked conftool backend and driver.""" # pylint: disable=attribute-defined-outside-init self.conftool_backend = MockBackend({}) confctl.kvobject.KVObject.backend = self.conftool_backend confctl.kvobject.KVObject.config = confctl.configuration.Config(driver="") config = get_fixture_path("confctl", "config.yaml") schema = get_fixture_path("confctl", "schema.yaml") with mock.patch("spicerack.confctl.kvobject.KVObject.setup"): self.confctl = confctl.Confctl(config=config, schema=schema, dry_run=False) self.entity = self.confctl._schema.entities["discovery"] # pylint: disable=protected-access self.entity.query = mock.MagicMock(return_value=[self.entity("test", "dnsdisc")]) self.discovery = confctl.ConftoolEntity(self.entity, dry_run=False) self.discovery_dry_run = confctl.ConftoolEntity(self.entity)
def setUp(self): KVObject.backend = MockBackend({}) KVObject.config = configuration.Config(driver="") self.schema_file = os.path.join(test_base, 'fixtures', 'schema.yaml')
def setUp(self): KVObject.backend = MockBackend({}) KVObject.config = configuration.Config(driver="")
def setUp(self): KVObject.backend = MockBackend({}) KVObject.config = configuration.Config(driver="") self.entity = MockEntity('Foo', 'Bar', 'test')