Code Duplication    Length = 16-18 lines in 4 locations

elodie/tests/elodie_test.py 4 locations

@@ 131-148 (lines=18) @@
128
129
    assert helper.path_tz_fix(os.path.join('2016-04-Apr','London',u'2016-04-07_11-15-26-unicode\u2713filename-sample-title.txt')) in dest_path, dest_path
130
131
def test_import_file_path_utf8_encoded_ascii_latin_nbsp():
132
    temporary_folder, folder = helper.create_working_folder()
133
    temporary_folder_destination, folder_destination = helper.create_working_folder()
134
135
    origin = text_type(folder)+u'/unicode'+six_unichr(160)+u'filename.txt'
136
    # encode the unicode string to ascii
137
    origin = origin.encode('utf-8')
138
139
    shutil.copyfile(helper.get_file('valid.txt'), origin)
140
141
    helper.reset_dbs()
142
    dest_path = elodie.import_file(origin, folder_destination, False, False, False)
143
    helper.restore_dbs()
144
145
    shutil.rmtree(folder)
146
    shutil.rmtree(folder_destination)
147
148
    assert helper.path_tz_fix(os.path.join('2016-04-Apr','London',u'2016-04-07_11-15-26-unicode\xa0filename-sample-title.txt')) in dest_path, dest_path
149
150
def test_import_file_path_unicode_latin_nbsp():
151
    temporary_folder, folder = helper.create_working_folder()
@@ 95-112 (lines=18) @@
92
93
    assert helper.path_tz_fix(os.path.join('2015-01-Jan','California','2015-01-19_12-45-11-video.mov')) in dest_path, dest_path
94
95
def test_import_file_path_utf8_encoded_ascii_checkmark():
96
    temporary_folder, folder = helper.create_working_folder()
97
    temporary_folder_destination, folder_destination = helper.create_working_folder()
98
99
    origin = text_type(folder)+u'/unicode\u2713filename.txt'
100
    # encode the unicode string to ascii
101
    origin = origin.encode('utf-8')
102
103
    shutil.copyfile(helper.get_file('valid.txt'), origin)
104
105
    helper.reset_dbs()
106
    dest_path = elodie.import_file(origin, folder_destination, False, False, False)
107
    helper.restore_dbs()
108
109
    shutil.rmtree(folder)
110
    shutil.rmtree(folder_destination)
111
112
    assert helper.path_tz_fix(os.path.join('2016-04-Apr','London',u'2016-04-07_11-15-26-unicode\u2713filename-sample-title.txt')) in dest_path, dest_path
113
114
def test_import_file_path_unicode_checkmark():
115
    temporary_folder, folder = helper.create_working_folder()
@@ 150-165 (lines=16) @@
147
148
    assert helper.path_tz_fix(os.path.join('2016-04-Apr','London',u'2016-04-07_11-15-26-unicode\xa0filename-sample-title.txt')) in dest_path, dest_path
149
150
def test_import_file_path_unicode_latin_nbsp():
151
    temporary_folder, folder = helper.create_working_folder()
152
    temporary_folder_destination, folder_destination = helper.create_working_folder()
153
154
    origin = text_type(folder)+u'/unicode'+six_unichr(160)+u'filename.txt'
155
156
    shutil.copyfile(helper.get_file('valid.txt'), origin)
157
158
    helper.reset_dbs()
159
    dest_path = elodie.import_file(origin, folder_destination, False, False, False)
160
    helper.restore_dbs()
161
162
    shutil.rmtree(folder)
163
    shutil.rmtree(folder_destination)
164
165
    assert helper.path_tz_fix(os.path.join('2016-04-Apr','London',u'2016-04-07_11-15-26-unicode\xa0filename-sample-title.txt')) in dest_path, dest_path
166
    
167
def test_import_file_allow_duplicate_false():
168
    temporary_folder, folder = helper.create_working_folder()
@@ 114-129 (lines=16) @@
111
112
    assert helper.path_tz_fix(os.path.join('2016-04-Apr','London',u'2016-04-07_11-15-26-unicode\u2713filename-sample-title.txt')) in dest_path, dest_path
113
114
def test_import_file_path_unicode_checkmark():
115
    temporary_folder, folder = helper.create_working_folder()
116
    temporary_folder_destination, folder_destination = helper.create_working_folder()
117
118
    origin = text_type(folder)+u'/unicode\u2713filename.txt'
119
120
    shutil.copyfile(helper.get_file('valid.txt'), origin)
121
122
    helper.reset_dbs()
123
    dest_path = elodie.import_file(origin, folder_destination, False, False, False)
124
    helper.restore_dbs()
125
126
    shutil.rmtree(folder)
127
    shutil.rmtree(folder_destination)
128
129
    assert helper.path_tz_fix(os.path.join('2016-04-Apr','London',u'2016-04-07_11-15-26-unicode\u2713filename-sample-title.txt')) in dest_path, dest_path
130
131
def test_import_file_path_utf8_encoded_ascii_latin_nbsp():
132
    temporary_folder, folder = helper.create_working_folder()