1 # -*- coding: utf-8 -*- |
1 # -*- coding: utf-8 -*- |
2 # copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved. |
2 # copyright 2003-2012 LOGILAB S.A. (Paris, FRANCE), all rights reserved. |
3 # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr |
3 # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr |
4 # |
4 # |
5 # This file is part of CubicWeb. |
5 # This file is part of CubicWeb. |
6 # |
6 # |
7 # CubicWeb is free software: you can redistribute it and/or modify it under the |
7 # CubicWeb is free software: you can redistribute it and/or modify it under the |
29 class CWPropertyHooksTC(CubicWebTC): |
29 class CWPropertyHooksTC(CubicWebTC): |
30 |
30 |
31 def test_unexistant_cwproperty(self): |
31 def test_unexistant_cwproperty(self): |
32 with self.assertRaises(ValidationError) as cm: |
32 with self.assertRaises(ValidationError) as cm: |
33 self.execute('INSERT CWProperty X: X pkey "bla.bla", X value "hop", X for_user U') |
33 self.execute('INSERT CWProperty X: X pkey "bla.bla", X value "hop", X for_user U') |
34 cm.exception.tr(unicode) |
34 cm.exception.translate(unicode) |
35 self.assertEqual(cm.exception.errors, {'pkey-subject': 'unknown property key bla.bla'}) |
35 self.assertEqual(cm.exception.errors, {'pkey-subject': 'unknown property key bla.bla'}) |
36 with self.assertRaises(ValidationError) as cm: |
36 with self.assertRaises(ValidationError) as cm: |
37 self.execute('INSERT CWProperty X: X pkey "bla.bla", X value "hop"') |
37 self.execute('INSERT CWProperty X: X pkey "bla.bla", X value "hop"') |
38 cm.exception.tr(unicode) |
38 cm.exception.translate(unicode) |
39 self.assertEqual(cm.exception.errors, {'pkey-subject': 'unknown property key bla.bla'}) |
39 self.assertEqual(cm.exception.errors, {'pkey-subject': 'unknown property key bla.bla'}) |
40 |
40 |
41 def test_site_wide_cwproperty(self): |
41 def test_site_wide_cwproperty(self): |
42 with self.assertRaises(ValidationError) as cm: |
42 with self.assertRaises(ValidationError) as cm: |
43 self.execute('INSERT CWProperty X: X pkey "ui.site-title", X value "hop", X for_user U') |
43 self.execute('INSERT CWProperty X: X pkey "ui.site-title", X value "hop", X for_user U') |