Esempio n. 1
0
    def persist_data(self, data):
        for doc in data:
            FakeModel(**doc)

            # Index the document with .index()
            FakeDjangoMappingType.index(doc, id_=doc["id"])

        self.refresh(FakeDjangoMappingType.get_index())
Esempio n. 2
0
    def persist_data(self, data):
        for doc in data:
            FakeModel(**doc)

            # Index the document with .index()
            FakeDjangoMappingType.index(doc, id_=doc['id'])

        self.refresh(FakeDjangoMappingType.get_index())
Esempio n. 3
0
    def test_index(self):
        document = {'id': 1, 'name': 'odin skullcrusher'}

        # Generate the FakeModel in our "database"
        FakeModel(**document)

        # Index the document with .index()
        FakeDjangoMappingType.index(document, id_=document['id'])

        self.refresh(FakeDjangoMappingType.get_index())

        # Query it to make sure it's there.
        eq_(len(S(FakeDjangoMappingType).query(name__prefix='odin')), 1)
Esempio n. 4
0
    def test_index(self):
        document = {'id': 1, 'name': 'odin skullcrusher'}

        # Generate the FakeModel in our "database"
        FakeModel(**document)

        # Index the document with .index()
        FakeDjangoMappingType.index(document, id_=document['id'])

        self.refresh(FakeDjangoMappingType.get_index())

        # Query it to make sure it's there.
        eq_(len(S(FakeDjangoMappingType).query(name__prefix='odin')), 1)