Commit a2363ee9 authored by Rob Carleski's avatar Rob Carleski 🇮🇸
Browse files

Fix label prefix creation and assignment

parent bb17d477
......@@ -72,7 +72,7 @@ class Mover:
'-',
label
)
if hasattr(self, 'label_prefix'):
if self.label_prefix:
self.transfer[label]['destination'] = '{}-{}'.format(
self.label_prefix,
label
......@@ -277,7 +277,6 @@ def main():
'--label_prefix',
'-p',
help='A prefix to append to existing label names',
default=''
)
parser.add_argument(
'--email_directory',
......
......@@ -12,6 +12,7 @@ def test_transfer_label_list():
'current_owner': 'testuser',
'new_owner': 'testuser',
'labels': ['label1', 'label2'],
'label_prefix': None,
'email_directory': None
}
mover = transfer_mail.Mover(
......@@ -27,6 +28,7 @@ def test_transfer_label_file():
'current_owner': 'testuser',
'new_owner': 'testuser',
'label_file': data_dir + '/mock_gyb/test_transfer_mail.txt',
'label_prefix': None,
'email_directory': None
}
mover = transfer_mail.Mover(
......@@ -58,6 +60,7 @@ def test_search_translation():
'current_owner': 'testuser',
'new_owner': 'testuser',
'label_file': data_dir + '/mock_gyb/test_transfer_mail.txt',
'label_prefix': None,
'email_directory': None
}
mover = transfer_mail.Mover(
......@@ -75,6 +78,7 @@ def test_with_existing_custom_dir():
'current_owner': 'testuser',
'new_owner': 'testuser',
'labels': ['label1', 'label2'],
'label_prefix': None,
'email_directory': '/var/tmp'
}
mover = transfer_mail.Mover(
......@@ -90,6 +94,7 @@ def test_with_new_custom_dir():
'current_owner': 'testuser',
'new_owner': 'testuser',
'labels': ['label1', 'label2'],
'label_prefix': None,
'email_directory': '/var/tmp/gtm1a2b3c4d'
}
mover = transfer_mail.Mover(
......@@ -109,7 +114,8 @@ def test_transfer_with_bad_current_owner():
args = {
'current_owner': 'notauser',
'new_owner': 'testuser',
'labels': ['label1', 'label2']
'labels': ['label1', 'label2'],
'label_prefix': None
}
mover = transfer_mail.Mover(
args,
......@@ -124,7 +130,8 @@ def test_transfer_with_bad_new_owner():
args = {
'current_owner': 'testuser',
'new_owner': 'notauser',
'labels': ['label1', 'label2']
'labels': ['label1', 'label2'],
'label_prefix': None
}
mover = transfer_mail.Mover(
args,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment