示例#1
0
    def test_register(self):
        history.register(DataContext, fields=["name", "description", "json"])
        self.assertTrue(DataContext in history.registry)
        self.assertEqual(
            history.registry[DataContext],
            {"fields": ("json", "name", "description"), "dispatch_uid": "DataContext_revision"},
        )

        history.unregister(DataContext)
        self.assertFalse(DataContext in history.registry)
示例#2
0
文件: tests.py 项目: rysdyk/avocado
    def test_register(self):
        history.register(DataContext, fields=['name', 'description', 'json'])
        self.assertTrue(DataContext in history.registry)
        self.assertEqual(history.registry[DataContext], {
            'fields': ('json', 'name', 'description'),
            'dispatch_uid': 'DataContext_revision',
        })

        history.unregister(DataContext)
        self.assertFalse(DataContext in history.registry)
示例#3
0
文件: tests.py 项目: hassanNS/avocado
    def test_register(self):
        history.register(DataContext, fields=['name', 'description', 'json'])
        self.assertTrue(DataContext in history.registry)
        self.assertEqual(history.registry[DataContext], {
            'fields': ('json', 'name', 'description'),
            'dispatch_uid': 'DataContext_revision',
        })

        history.unregister(DataContext)
        self.assertFalse(DataContext in history.registry)
示例#4
0
 def setUp(self):
     history.register(DataContext, fields=['name', 'description', 'json'])
示例#5
0
 def setUp(self):
     history.register(DataContext, fields=["name", "description", "json"])
示例#6
0
        # again.
        if self.shared_users.filter(email__iexact=email).exists():
            return False

        try:
            user = User.objects.get(email__iexact=email)
        except User.DoesNotExist:
            if not create_user:
                return False
            else:
                user = utils.create_email_based_user(email)

        self.shared_users.add(user)
        self.save()

# Register instance-level cache invalidation handlers
post_save.connect(post_save_cache, sender=DataField)
post_save.connect(post_save_cache, sender=DataConcept)
post_save.connect(post_save_cache, sender=DataCategory)

pre_delete.connect(pre_delete_uncache, sender=DataField)
pre_delete.connect(pre_delete_uncache, sender=DataConcept)
pre_delete.connect(pre_delete_uncache, sender=DataCategory)

# Register with history API
if settings.HISTORY_ENABLED:
    history.register(DataContext, fields=('name', 'description', 'json'))
    history.register(DataView, fields=('name', 'description', 'json'))
    history.register(DataQuery, fields=('name', 'description', 'context_json',
                                        'view_json'))
示例#7
0
文件: tests.py 项目: hassanNS/avocado
 def setUp(self):
     history.register(DataContext, fields=['name', 'description', 'json'])
示例#8
0
            return False

        try:
            user = User.objects.get(email__iexact=email)
        except User.DoesNotExist:
            if not create_user:
                return False
            else:
                user = utils.create_email_based_user(email)

        self.shared_users.add(user)
        self.save()


# Register instance-level cache invalidation handlers
post_save.connect(post_save_cache, sender=DataField)
post_save.connect(post_save_cache, sender=DataConcept)
post_save.connect(post_save_cache, sender=DataCategory)

pre_delete.connect(pre_delete_uncache, sender=DataField)
pre_delete.connect(pre_delete_uncache, sender=DataConcept)
pre_delete.connect(pre_delete_uncache, sender=DataCategory)

# Register with history API
if settings.HISTORY_ENABLED:
    history.register(DataContext, fields=('name', 'description', 'json'))
    history.register(DataView, fields=('name', 'description', 'json'))
    history.register(DataQuery,
                     fields=('name', 'description', 'context_json',
                             'view_json'))