

def setUp(self):
    doc.migration = Migrator(slug='user_db_migration', source_db_name=None, target_db_name=settings.NEW_USERS_GROUPS_DB, doc_types=('Group', 'CommCareUser'))
    delete_all_docs_by_doc_type(self.migration.source_db, self.migration.doc_types)
    self.migration.target_db.delete_docs(_get_non_design_docs(self.migration.target_db))
    self.docs = [{
        'doc_type': 'CommCareUser',
        'username': 'johnny@example.com',
    }, {
        'doc_type': 'CommCareUser',
        'username': 'fatima@example.com',
        '_attachments': {
            'greeting.txt': {
                'content_type': 'text/plain',
                'data': base64.b64encode('hi'),
                'digest': 'md5-QTVOnBwGnrw6Tx9YG1ZRyA==',
                'revpos': 1,
            },
        },
    }, {
        'doc_type': 'Group',
        'name': 'User Group',
    }, {
        'doc_type': 'Group-Deleted',
        'name': 'Deleted User Group',
    }]
    results = self.migration.source_db.bulk_save(self.docs)
    for (doc, result) in zip(self.docs, results):
        doc['_id'] = result['id']
        doc['_rev'] = result['rev']
    _sort_by_doc_id(self.docs)

dataset/ETHPy150Open dimagi/commcare-hq/corehq/doctypemigrations/tests.py TestDocTypeMigrations.setUp/VarMisuse@10/12 `self`->`doc`