Exemplo n.º 1
0
 def test_validate(self):
     from ebpub.db.schemafilters import SchemaFilter
     schema = models.Schema.objects.get(slug='crime')
     fil = SchemaFilter(request=None,
                        context={},
                        queryset=None,
                        schema=schema)
     self.assertEqual(fil.validate(), {})
Exemplo n.º 2
0
 def test_apply(self):
     from ebpub.db.schemafilters import SchemaFilter
     schema = models.Schema.objects.get(slug='crime')
     fil = SchemaFilter(request=None, context={}, queryset=None, schema=schema)
     fil.apply()
     self.assert_(len(fil.qs) > 0)
     for item in fil.qs:
         self.assertEqual(item.schema.natural_key(), schema.natural_key())
Exemplo n.º 3
0
 def test_apply__with_request(self, mock_get_mgr):
     from ebpub.db.schemafilters import SchemaFilter
     schema = models.Schema.objects.get(slug='crime')
     request = mock.Mock()
     mock_get_mgr.return_value = models.Schema.objects
     fil = SchemaFilter(request=request, context={}, queryset=None,
                        schema=[schema, schema])
     fil.apply()
     self.assertEqual(mock_get_mgr.call_count, 1)
Exemplo n.º 4
0
 def test_apply(self):
     from ebpub.db.schemafilters import SchemaFilter
     schema = models.Schema.objects.get(slug='crime')
     fil = SchemaFilter(request=None,
                        context={},
                        queryset=None,
                        schema=schema)
     fil.apply()
     self.assert_(len(fil.qs) > 0)
     for item in fil.qs:
         self.assertEqual(item.schema.natural_key(), schema.natural_key())
Exemplo n.º 5
0
 def test_apply__with_request(self, mock_get_mgr):
     from ebpub.db.schemafilters import SchemaFilter
     schema = models.Schema.objects.get(slug='crime')
     request = mock.Mock()
     mock_get_mgr.return_value = models.Schema.objects
     fil = SchemaFilter(request=request,
                        context={},
                        queryset=None,
                        schema=[schema, schema])
     fil.apply()
     self.assertEqual(mock_get_mgr.call_count, 1)
Exemplo n.º 6
0
 def test_validate(self):
     from ebpub.db.schemafilters import SchemaFilter
     schema = models.Schema.objects.get(slug='crime')
     fil = SchemaFilter(request=None, context={}, queryset=None, schema=schema)
     self.assertEqual(fil.validate(), {})