Beispiel #1
0
 def test_secure_with_value(self):
     p = Parameter('foobar-service',
                   'foobar-cluster',
                   yml='KEY:secure=lkjasdlfkj:a490jlaisfdj\ew')
     compare(
         p._render_write(), {
             'Name': 'foobar-cluster.foobar-service.KEY',
             'Value': 'lkjasdlfkj:a490jlaisfdj\ew',
             'Overwrite': True,
             'Type': 'SecureString'
         })
Beispiel #2
0
 def test_external(self):
     p = Parameter('foobar-service', 'foobar-cluster', yml='KEY:external')
     self.assertEqual(p.key, 'KEY')
     self.assertEqual(p.value, None)
     self.assertEqual(p.is_external, True)
     self.assertEqual(p.is_secure, False)
     self.assertEqual(p.kms_key_id, None)
Beispiel #3
0
 def test_secure_with_value(self):
     p = Parameter('foobar-service',
                   'foobar-cluster',
                   yml='KEY:secure=lkjasdlfkj:a490jlaisfdj\ew')
     self.assertEqual(p.key, 'KEY')
     self.assertEqual(p.value, "lkjasdlfkj:a490jlaisfdj\ew")
     self.assertEqual(p.is_external, False)
     self.assertEqual(p.is_secure, True)
     self.assertEqual(p.kms_key_id, None)
Beispiel #4
0
 def test_bare_key_dots_with_value(self):
     p = Parameter(
         'foobar-service',
         'foobar-cluster',
         yml='cluster-name.service-name.KEY=lkjasdlfkj:a490jlaisfdj\ew')
     self.assertEqual(p.key, 'cluster-name.service-name.KEY')
     self.assertEqual(p.value, "lkjasdlfkj:a490jlaisfdj\ew")
     self.assertEqual(p.is_external, False)
     self.assertEqual(p.is_secure, False)
     self.assertEqual(p.kms_key_id, None)
 def setUp(self):
     current_dir = os.path.dirname(os.path.abspath(__file__))
     filename = os.path.join(current_dir, 'simple.yml')
     self.config = Config(filename=filename, interpolate=False)
     with Replacer() as r:
         r.replace('deployfish.aws.ecs.Service.from_aws', Mock())
         self.service = Service('foobar-prod', config=self.config)
         p = Parameter('foobar-service', 'foobar-cluster', yml='KEY=VALUE')
         self.service.parameter_store.append(p)
         self.service.desired_task_definition.set_parameter_store(self.service.parameter_store)
Beispiel #6
0
 def test_secure_with_value_plus_kms_key(self):
     p = Parameter(
         'foobar-service',
         'foobar-cluster',
         yml=
         'KEY:secure:arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab=lkjasdlfkj:a490jlaisfdj\ew'
     )
     compare(
         p._render_write(), {
             'Name':
             'foobar-cluster.foobar-service.KEY',
             'Value':
             'lkjasdlfkj:a490jlaisfdj\ew',
             'Overwrite':
             True,
             'Type':
             'SecureString',
             'KeyId':
             'arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab'
         })
Beispiel #7
0
 def test_secure_with_value_plus_kms_key(self):
     p = Parameter(
         'foobar-service',
         'foobar-cluster',
         yml=
         'KEY:secure:arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab=lkjasdlfkj:a490jlaisfdj\ew'
     )
     self.assertEqual(p.key, 'KEY')
     self.assertEqual(p.value, "lkjasdlfkj:a490jlaisfdj\ew")
     self.assertEqual(p.is_external, False)
     self.assertEqual(p.is_secure, True)
     self.assertEqual(
         p.kms_key_id,
         "arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab"
     )
Beispiel #8
0
 def test_external_secure_plus_kms_key(self):
     p = Parameter(
         'foobar-service',
         'foobar-cluster',
         yml=
         'KEY:external:secure:arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab'
     )
     self.assertEqual(p.key, 'KEY')
     self.assertEqual(p.value, None)
     self.assertEqual(p.is_external, True)
     self.assertEqual(p.is_secure, True)
     self.assertEqual(
         p.kms_key_id,
         "arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab"
     )