def test_release_successful(self):
     upload_cfn_to_s3(self.project, mock.MagicMock(Logger))
     cfn_release(self.project, mock.MagicMock(Logger))
     key_prefix = self.project.get_property('template_key_prefix')
     s3_keys = [o.key for o
                in self.s3.Bucket(self.bucket_name).objects.all()]
     for (path, filename) in self.test_files:
         key_path = '{0}latest/{1}'.format(
                 key_prefix, filename.replace('yml', 'json'))
         self.assertTrue(
             key_path in s3_keys,
             "Key {0} not found in {1}".format(key_path, s3_keys))
         s3_grants = self.s3.Object(
                 bucket_name=self.bucket_name, key=key_path).Acl().grants
         self.assertDictContainsSubset(
             {"Permission": "FULL_CONTROL"},
             s3_grants[0])
Exemplo n.º 2
0
 def test_release_successful(self):
     upload_cfn_to_s3(self.project, mock.MagicMock(Logger))
     cfn_release(self.project, mock.MagicMock(Logger))
     key_prefix = self.project.get_property('template_key_prefix')
     s3_keys = [
         o.key for o in self.s3.Bucket(self.bucket_name).objects.all()
     ]
     for (path, filename) in self.test_files:
         key_path = '{0}latest/{1}'.format(key_prefix,
                                           filename.replace('yml', 'json'))
         self.assertTrue(
             key_path in s3_keys,
             "Key {0} not found in {1}".format(key_path, s3_keys))
         s3_grants = self.s3.Object(bucket_name=self.bucket_name,
                                    key=key_path).Acl().grants
         self.assertDictContainsSubset({"Permission": "FULL_CONTROL"},
                                       s3_grants[0])
    def test_upload_cfn_files(self):
        upload_cfn_to_s3(self.project, mock.MagicMock(Logger))
        s3_object_list = [
            o for o in self.s3.Bucket(self.bucket_name).objects.all()]

        key_prefix = self.project.get_property('template_key_prefix')
        self.assertEqual(s3_object_list[0].bucket_name, self.bucket_name)
        keys = [o.key for o in s3_object_list]
        for test_file in self.test_files:
            version_path = '{0}v{1}/{2}'.format(
                    key_prefix, self.project.version,
                    test_file[1].replace('yml', 'json'))
            self.assertTrue(
                version_path in keys,
                "Key {0} not found in {1}".format(version_path, keys))
            s3_grants = self.s3.Object(
                bucket_name=self.bucket_name, key=version_path).Acl().grants
            self.assertDictContainsSubset(
                {"Permission": "FULL_CONTROL"},
                s3_grants[0])
Exemplo n.º 4
0
    def test_upload_cfn_files(self):
        upload_cfn_to_s3(self.project, mock.MagicMock(Logger))
        s3_object_list = [
            o for o in self.s3.Bucket(self.bucket_name).objects.all()
        ]

        key_prefix = self.project.get_property('template_key_prefix')
        self.assertEqual(s3_object_list[0].bucket_name, self.bucket_name)
        keys = [o.key for o in s3_object_list]
        for test_file in self.test_files:
            version_path = '{0}v{1}/{2}'.format(
                key_prefix, self.project.version,
                test_file[1].replace('yml', 'json'))
            self.assertTrue(
                version_path in keys,
                "Key {0} not found in {1}".format(version_path, keys))
            s3_grants = self.s3.Object(bucket_name=self.bucket_name,
                                       key=version_path).Acl().grants
            self.assertDictContainsSubset({"Permission": "FULL_CONTROL"},
                                          s3_grants[0])