def setUp(self): # noqa self.doc = edmx.Document() md_path = TEST_DATA_DIR.join('sample_server', 'metadata.xml') with md_path.open('rb') as f: self.doc.Read(f) self.container = self.doc.root.DataServices[ "SampleModel.SampleEntities"]
def setUp(self): # noqa path = os.path.join(DATA_DIR, 'blockstore.xml') self.doc = edmx.Document() with open(path, 'rb') as f: self.doc.Read(f) self.cdef = self.doc.root.DataServices['BlockSchema.BlockContainer'] self.container = InMemoryEntityContainer(self.cdef)
def setUp(self): # noqa self.doc = edmx.Document() mdpath = TEST_DATA_DIR.join('sample_server', 'metadata.xml') with mdpath.open('rb') as f: self.doc.Read(f) self.schema = self.doc.root.DataServices['SampleModel'] self.containerDef = self.doc.root.DataServices[ "SampleModel.SampleEntities"] self.container = InMemoryEntityContainer(self.containerDef) self.employees = self.container.entityStorage['Employees']
def setUp(self): # noqa self.d = FilePath.mkdtemp('.d', 'pyslet-test_blockstore-') path = os.path.join(DATA_DIR, 'blockstore.xml') self.doc = edmx.Document() with open(path, 'rb') as f: self.doc.Read(f) self.cdef = self.doc.root.DataServices['BlockSchema.BlockContainer'] self.block_size = random.randint(1, 100) logging.info("File block size: %i", self.block_size) self.f = self.d.join('blockstore.test').open('w+b') self.fox = (u"The quick brown fox jumped over the lazy dog " u"Caf\xe9".encode('utf-8'))
def setUp(self): # noqa path = os.path.join(DATA_DIR, 'blockstore.xml') self.doc = edmx.Document() with open(path, 'rb') as f: self.doc.Read(f) self.cdef = self.doc.root.DataServices['BlockSchema.BlockContainer'] self.container = InMemoryEntityContainer(self.cdef) self.mt_lock = threading.Lock() self.mt_count = 0 self.bs = EDMBlockStore(entity_set=self.cdef['Blocks'], max_block_size=64) self.ls = LockStore(entity_set=self.cdef['BlockLocks'])
def setUp(self): # noqa self.cwd = FilePath.getcwd() TEST_DATA_DIR.chdir() self.doc = edmx.Document() md_path = TEST_DATA_DIR.join('sqlds', 'custom.xml') with md_path.open('rb') as f: self.doc.Read(f) self.schema = self.doc.root.DataServices['CustomModel'] self.container = self.doc.root.DataServices[ "CustomModel.FileContainer"] self.d = FilePath.mkdtemp('.d', 'pyslet-test_odata2_sqlds-') self.db = CustomisedContainer(file_path=self.d.join('test.db'), container=self.container)
def setUp(self): # noqa self.cwd = FilePath.getcwd() TEST_DATA_DIR.chdir() self.doc = edmx.Document() md_path = TEST_DATA_DIR.join('sample_server', 'metadata.xml') with md_path.open('rb') as f: self.doc.Read(f) self.schema = self.doc.root.DataServices['SampleModel'] self.container = self.doc.root.DataServices[ "SampleModel.SampleEntities"] self.d = FilePath.mkdtemp('.d', 'pyslet-test_odata2_sqlds-') self.db = SQLiteEntityContainer(file_path=self.d.join('test.db'), container=self.container)
def test_valid_metadata_examples(self): dpath = os.path.join(TEST_DATA_DIR, 'valid') for fName in os.listdir(dpath): if fName[-4:] != ".xml": continue logging.debug("testing valid Edmx file %s", fName) f = uri.URI.from_path(os.path.join(dpath, fName)) doc = edmx.Document(baseURI=f) try: doc.Read() doc.validate() except (edm.ModelError, edm.DuplicateName), e: self.fail("%s is valid but raised " "InvalidMetadataDocument: %s" % (fName, str(e)))
def test_invalid_metadata_examples(self): dpath = os.path.join(TEST_DATA_DIR, 'invalid') for fName in os.listdir(dpath): if fName[-4:] != ".xml": continue logging.debug("testing invalid Edmx file %s", fName) f = uri.URI.from_path(os.path.join(dpath, fName)) doc = edmx.Document(base_uri=f) try: doc.read() doc.validate() self.fail("%s is invalid but did not raise " "InvalidMetadataDocument" % fName) except (edm.ModelError, edm.DuplicateName): pass