def test_set_key_refuses_empty_keys(self):
     with Replacer() as r:
         r.replace(
             'deployfish.aws.systems_manager.UnboundParameter._from_aws',
             Mock())
         p = UnboundParameter('BAZ')
         with self.assertRaises(ValueError):
             p.key = ''
         with self.assertRaises(ValueError):
             p.key = None
 def test_set_key_reloads_aws_object(self):
     from_aws = Mock()
     with Replacer() as r:
         r.replace(
             'deployfish.aws.systems_manager.UnboundParameter._from_aws',
             from_aws)
         p = UnboundParameter('BAZ')
         p.key = 'BARNEY'
         compare(from_aws.mock_calls, [call(), call()])
 def test_set_key_sets_key(self):
     from_aws = Mock()
     with Replacer() as r:
         r.replace(
             'deployfish.aws.systems_manager.UnboundParameter._from_aws',
             from_aws)
         p = UnboundParameter('BAZ')
         p.key = 'BARNEY'
         self.assertEqual(p.key, 'BARNEY')
 def test_set_key_sets_key_without_changing_prefix(self):
     from_aws = Mock()
     with Replacer() as r:
         r.replace(
             'deployfish.aws.systems_manager.UnboundParameter._from_aws',
             from_aws)
         p = UnboundParameter('foo.bar.BAZ')
         p.key = 'BARNEY'
         self.assertEqual(p.key, 'BARNEY')
         self.assertEqual(p.prefix, 'foo.bar.')