~ubuntu-branches/ubuntu/utopic/heat/utopic-proposed

« back to all changes in this revision

Viewing changes to heat/tests/test_properties.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short, Corey Bryant
  • Date: 2015-02-09 15:12:41 UTC
  • mfrom: (1.1.22)
  • Revision ID: package-import@ubuntu.com-20150209151241-e62zx02m846zet2r
Tags: 2014.2.2-0ubuntu1
[ Corey Bryant ]
* Resynchronize with stable/juno (423ee27) (LP: #1418695):
  - [b52c916] Convert bool/int values into string for string properties
  - [65294f4] Check that template format plugins are registered
  - [94dec9e] Disable nested validation for ResourceGroup with zero count
  - [c5346cd] Remove mocking of timeutils.utcnow
  - [d8abdfd] Always update nested stacks
  - [edf0198] ResourceGroup allow update of resource_def
  - [aabd3d8] Add Dimensions Default in AWS_CloudWatch_Alarm.yaml
  - [bbf7182] Fix error msg invalid stack or res name
  - [423ee27] Use kwargs for ResourcePropertyConflict exception
* d/p/fix-requirements.patch: Rebased.
* d/control: Bump minimum python-eventlet to get socket_timeout support.

Show diffs side-by-side

added added

removed removed

Lines of Context:
703
703
        self.assertEqual("int() argument must be a string or a number, "
704
704
                         "not 'list'", six.text_type(ex))
705
705
 
 
706
    def test_str_from_int(self):
 
707
        schema = {'Type': 'String'}
 
708
        p = properties.Property(schema)
 
709
        self.assertEqual('3', p.get_value(3))
 
710
 
 
711
    def test_str_from_bool(self):
 
712
        schema = {'Type': 'String'}
 
713
        p = properties.Property(schema)
 
714
        self.assertEqual('True', p.get_value(True))
 
715
 
706
716
    def test_int_from_str_good(self):
707
717
        schema = {'Type': 'Integer'}
708
718
        p = properties.Property(schema)
1514
1524
        props = properties.Properties(schema, {})
1515
1525
        self.assertIsNone(props.validate())
1516
1526
 
1517
 
    def test_bad_data(self):
1518
 
        schema = {'foo': {'Type': 'String'}}
1519
 
        props = properties.Properties(schema, {'foo': 42})
1520
 
        self.assertRaises(exception.StackValidationFailed, props.validate)
1521
 
 
1522
1527
    def test_unknown_typo(self):
1523
1528
        schema = {'foo': {'Type': 'String'}}
1524
1529
        props = properties.Properties(schema, {'food': 42})
1525
1530
        self.assertRaises(exception.StackValidationFailed, props.validate)
1526
1531
 
 
1532
    def test_list_instead_string(self):
 
1533
        schema = {'foo': {'Type': 'String'}}
 
1534
        props = properties.Properties(schema, {'foo': ['foo', 'bar']})
 
1535
        ex = self.assertRaises(exception.StackValidationFailed, props.validate)
 
1536
        self.assertEqual('Property error : foo Value must be a string',
 
1537
                         six.text_type(ex))
 
1538
 
 
1539
    def test_dict_instead_string(self):
 
1540
        schema = {'foo': {'Type': 'String'}}
 
1541
        props = properties.Properties(schema, {'foo': {'foo': 'bar'}})
 
1542
        ex = self.assertRaises(exception.StackValidationFailed, props.validate)
 
1543
        self.assertEqual('Property error : foo Value must be a string',
 
1544
                         six.text_type(ex))
 
1545
 
1527
1546
    def test_none_string(self):
1528
1547
        schema = {'foo': {'Type': 'String'}}
1529
1548
        props = properties.Properties(schema, {'foo': None})