Code Duplication    Length = 14-17 lines in 2 locations

omaha_server/omaha/tests/test_s3.py 2 locations

@@ 39-55 (lines=17) @@
36
        obj = self.factory()
37
38
        keys = conn.get_bucket('test').get_all_keys()
39
        keys = [key.name for key in keys]
40
        for field in self.file_fields:
41
            self.assertIn(getattr(obj, field).name, keys)
42
43
        obj.delete()
44
        keys = conn.get_bucket('test').get_all_keys()
45
        self.assertFalse(keys)
46
47
    @moto.mock_s3
48
    def test_model_update(self):
49
        conn = boto.connect_s3()
50
        conn.create_bucket('test')
51
        obj = self.factory()
52
        new_obj = self.factory()
53
54
        old_keys = conn.get_bucket('test').get_all_keys()
55
        old_keys = [key.name for key in old_keys]
56
57
        for field in self.file_fields:
58
            self.assertIn(getattr(obj, field).name, old_keys)
@@ 24-37 (lines=14) @@
21
from omaha.limitation import bulk_delete
22
from storages.backends.s3boto import S3BotoStorage
23
from omaha.tasks import get_prefix
24
25
26
class BaseS3Test(object):
27
    model = None
28
    factory = None
29
    file_fields = None
30
    files = None
31
32
    @moto.mock_s3
33
    def test_model_delete(self):
34
        conn = boto.connect_s3()
35
        conn.create_bucket('test')
36
        obj = self.factory()
37
38
        keys = conn.get_bucket('test').get_all_keys()
39
        keys = [key.name for key in keys]
40
        for field in self.file_fields: