Exemple #1
0
    def test_get_objects_and_sigs_infected_with_sig(self):
        signature = "Eicar-Test-Signature FOUND"

        get_object_tagging_response = {
            "VersionId":
            "abc123",
            "TagSet": [
                {
                    "Key": AV_STATUS_METADATA,
                    "Value": AV_STATUS_INFECTED
                },
                {
                    "Key": AV_SIGNATURE_METADATA,
                    "Value": signature
                },
            ],
        }
        get_object_tagging_expected_params = {
            "Bucket": self.s3_bucket_name,
            "Key": "test.txt",
        }
        self.stubber.add_response(
            "get_object_tagging",
            get_object_tagging_response,
            get_object_tagging_expected_params,
        )

        with self.stubber:
            s3_object_list = get_objects_and_sigs(self.s3_client,
                                                  self.s3_bucket_name)
            expected_object_list = [("test.txt", signature)]
            self.assertEqual(s3_object_list, expected_object_list)
Exemple #2
0
    def test_get_objects_and_sigs_unscanned(self):

        get_object_tagging_response = {"VersionId": "abc123", "TagSet": []}
        get_object_tagging_expected_params = {
            "Bucket": self.s3_bucket_name,
            "Key": "test.txt",
        }
        self.stubber.add_response(
            "get_object_tagging",
            get_object_tagging_response,
            get_object_tagging_expected_params,
        )

        with self.stubber:
            s3_object_list = get_objects_and_sigs(self.s3_client,
                                                  self.s3_bucket_name)
            expected_object_list = []
            self.assertEqual(s3_object_list, expected_object_list)
Exemple #3
0
    def test_get_objects_and_sigs_clean(self):

        get_object_tagging_response = {
            "VersionId": "abc123",
            "TagSet": [{
                "Key": AV_STATUS_METADATA,
                "Value": AV_STATUS_CLEAN
            }],
        }
        get_object_tagging_expected_params = {
            "Bucket": self.s3_bucket_name,
            "Key": "test.txt",
        }
        self.stubber.add_response(
            "get_object_tagging",
            get_object_tagging_response,
            get_object_tagging_expected_params,
        )

        with self.stubber:
            s3_object_list = get_objects_and_sigs(self.s3_client,
                                                  self.s3_bucket_name)
            expected_object_list = []
            self.assertEqual(s3_object_list, expected_object_list)