def sync_design_doc(design, temp=None): sync_docs.sync_design_docs( db=design.db, design_dir=design.design_path, design_name=design.app_label, temp=temp, )
def test_sync_design_docs_tmp(self): db = MagicMock() with patch('dimagi.utils.couch.sync_docs.push', MagicMock()) as mock_push: sync_design_docs(db, 'design_dir', 'design_name', temp='tmp') mock_push.assert_called_with('design_dir', db, docid='_design/design_name-tmp', force=True) self.assertEqual(len(db.mock_calls), 4)
def test_sync_design_docs_tmp(self): db = MagicMock() with patch('dimagi.utils.couch.sync_docs.push', MagicMock()) as mock_push: sync_design_docs(db, 'design_dir', 'design_name', temp='tmp') mock_push.assert_called_with('design_dir', db, docid='_design/design_name-tmp', force=True) self.assertEquals(len(db.mock_calls), 4)
def sync_design_docs(temp=None): dir = os.path.abspath(os.path.dirname(__file__)) for pillow in import_pillows(instantiate=False): if hasattr(pillow, 'indicator_class'): app_label = pillow.indicator_class._meta.app_label db = get_db(app_label) sync_docs.sync_design_docs(db, os.path.join(dir, "_design"), FLUFF, temp=temp)
def sync_design_docs(self, temp=None): for app_label in self.get_couchapps(): sync_docs.sync_design_docs( db=self.db, design_dir=os.path.join(self.dir, app_label), design_name=app_label, temp=temp, )
def sync_design_docs(self, temp=None): for app_label in self.get_couchapps(): sync_docs.sync_design_docs( db=self.db(app_label), design_dir=os.path.join(self.dir, app_label), design_name=app_label, temp=temp, )
def test_sync_design_docs(self): db = NonCallableMock() with patch('dimagi.utils.couch.sync_docs.push', MagicMock()) as mock_push: sync_design_docs(db, 'design_dir', 'design_name') mock_push.assert_called_with('design_dir', db, docid='_design/design_name', force=True)
def sync_design_docs(self, temp=None): synced = set() for design in self.get_designs(): key = (design.db.uri, design.app_label) if key not in synced: sync_docs.sync_design_docs( db=design.db, design_dir=design.design_path, design_name=design.app_label, temp=temp, ) synced.add(key)
def sync_design_docs(self, temp=None): if self.synced: # workaround emit_post_sync_signal called twice # https://code.djangoproject.com/ticket/17977 # this is to speed up test initialization return self.synced = True synced = set() for design in self.get_designs(): key = (design.db.uri, design.app_label) if key not in synced: sync_docs.sync_design_docs( db=design.db, design_dir=design.design_path, design_name=design.app_label, temp=temp, ) synced.add(key)
def sync_design_docs(db, temp=None): dir = os.path.abspath(os.path.dirname(__file__)) for d in get_couchapps(): sync_docs.sync_design_docs(db, os.path.join(dir, d), d, temp=temp)