Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
aws
GitHub Repository: aws/aws-cli
Path: blob/develop/tests/unit/customizations/s3/syncstrategy/test_delete.py
1569 views
1
# Copyright 2014 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
#
3
# Licensed under the Apache License, Version 2.0 (the "License"). You
4
# may not use this file except in compliance with the License. A copy of
5
# the License is located at
6
#
7
# http://aws.amazon.com/apache2.0/
8
#
9
# or in the "license" file accompanying this file. This file is
10
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
11
# ANY KIND, either express or implied. See the License for the specific
12
# language governing permissions and limitations under the License.
13
import datetime
14
15
from awscli.customizations.s3.filegenerator import FileStat
16
from awscli.customizations.s3.syncstrategy.delete import DeleteSync
17
18
from awscli.testutils import unittest
19
20
21
class TestDeleteSync(unittest.TestCase):
22
def setUp(self):
23
self.sync_strategy = DeleteSync()
24
25
def test_determine_should_sync(self):
26
timenow = datetime.datetime.now()
27
28
dst_file = FileStat(src='', dest='',
29
compare_key='test.py', size=10,
30
last_update=timenow, src_type='local',
31
dest_type='s3', operation_name='')
32
33
should_sync = self.sync_strategy.determine_should_sync(
34
None, dst_file)
35
self.assertTrue(should_sync)
36
self.assertEqual(dst_file.operation_name, 'delete')
37
38
39
if __name__ == "__main__":
40
unittest.main()
41
42