Ejemplo n.º 1
0
 def test_duplicate_data(self):
     """Test that the RoleSerializer does not accept data."""
     view = mock.Mock()
     serializer = RoleSerializer(data=self.data, context={"view": view})
     self.assertTrue(serializer.is_valid())
     serializer.save()
     serializer = RoleSerializer(data=self.data, context={"view": view})
     self.assertFalse(serializer.is_valid())
Ejemplo n.º 2
0
 def test_valid_data(self):
     """Test that the RoleSerializer accepts valid data."""
     view = mock.Mock()
     serializer = RoleSerializer(data=self.data, context={"view": view})
     self.assertTrue(serializer.is_valid())