@@ 610-621 (lines=12) @@ | ||
607 | ||
608 | assert path == 'California', path |
|
609 | ||
610 | def test_parse_folder_name_multiple_keys_not_found(): |
|
611 | if hasattr(load_config, 'config'): |
|
612 | del load_config.config |
|
613 | filesystem = FileSystem() |
|
614 | place_name = {'default': u'United States of America', 'country': u'United States of America'} |
|
615 | mask = '%city-%state' |
|
616 | location_parts = re.findall('(%[^%]+)', mask) |
|
617 | path = filesystem.parse_mask_for_location(mask, location_parts, place_name) |
|
618 | if hasattr(load_config, 'config'): |
|
619 | del load_config.config |
|
620 | ||
621 | assert path == 'United States of America', path |
|
622 | ||
623 | def test_process_file_invalid(): |
|
624 | filesystem = FileSystem() |
|
@@ 597-608 (lines=12) @@ | ||
594 | ||
595 | assert path == 'California', path |
|
596 | ||
597 | def test_parse_folder_name_key_not_found_with_static_chars(): |
|
598 | if hasattr(load_config, 'config'): |
|
599 | del load_config.config |
|
600 | filesystem = FileSystem() |
|
601 | place_name = {'default': u'California', 'country': u'United States of America', 'state': u'California'} |
|
602 | mask = '%city-is-not-found' |
|
603 | location_parts = re.findall('(%[^%]+)', mask) |
|
604 | path = filesystem.parse_mask_for_location(mask, location_parts, place_name) |
|
605 | if hasattr(load_config, 'config'): |
|
606 | del load_config.config |
|
607 | ||
608 | assert path == 'California', path |
|
609 | ||
610 | def test_parse_folder_name_multiple_keys_not_found(): |
|
611 | if hasattr(load_config, 'config'): |
|
@@ 584-595 (lines=12) @@ | ||
581 | ||
582 | assert path == 'Sunnyvale-is-the-city', path |
|
583 | ||
584 | def test_parse_folder_name_key_not_found(): |
|
585 | if hasattr(load_config, 'config'): |
|
586 | del load_config.config |
|
587 | filesystem = FileSystem() |
|
588 | place_name = {'default': u'California', 'country': u'United States of America', 'state': u'California'} |
|
589 | mask = '%city' |
|
590 | location_parts = re.findall('(%[^%]+)', mask) |
|
591 | path = filesystem.parse_mask_for_location(mask, location_parts, place_name) |
|
592 | if hasattr(load_config, 'config'): |
|
593 | del load_config.config |
|
594 | ||
595 | assert path == 'California', path |
|
596 | ||
597 | def test_parse_folder_name_key_not_found_with_static_chars(): |
|
598 | if hasattr(load_config, 'config'): |
|
@@ 571-582 (lines=12) @@ | ||
568 | ||
569 | assert path == 'Sunnyvale-California-United States of America', path |
|
570 | ||
571 | def test_parse_folder_name_static_chars(): |
|
572 | if hasattr(load_config, 'config'): |
|
573 | del load_config.config |
|
574 | filesystem = FileSystem() |
|
575 | place_name = {'default': u'California', 'country': u'United States of America', 'state': u'California', 'city': u'Sunnyvale'} |
|
576 | mask = '%city-is-the-city' |
|
577 | location_parts = re.findall('(%[^%]+)', mask) |
|
578 | path = filesystem.parse_mask_for_location(mask, location_parts, place_name) |
|
579 | if hasattr(load_config, 'config'): |
|
580 | del load_config.config |
|
581 | ||
582 | assert path == 'Sunnyvale-is-the-city', path |
|
583 | ||
584 | def test_parse_folder_name_key_not_found(): |
|
585 | if hasattr(load_config, 'config'): |
|
@@ 558-569 (lines=12) @@ | ||
555 | ||
556 | assert path == 'Sunnyvale', path |
|
557 | ||
558 | def test_parse_folder_name_multiple(): |
|
559 | if hasattr(load_config, 'config'): |
|
560 | del load_config.config |
|
561 | filesystem = FileSystem() |
|
562 | place_name = {'default': u'California', 'country': u'United States of America', 'state': u'California', 'city': u'Sunnyvale'} |
|
563 | mask = '%city-%state-%country' |
|
564 | location_parts = re.findall('(%[^%]+)', mask) |
|
565 | path = filesystem.parse_mask_for_location(mask, location_parts, place_name) |
|
566 | if hasattr(load_config, 'config'): |
|
567 | del load_config.config |
|
568 | ||
569 | assert path == 'Sunnyvale-California-United States of America', path |
|
570 | ||
571 | def test_parse_folder_name_static_chars(): |
|
572 | if hasattr(load_config, 'config'): |
|
@@ 545-556 (lines=12) @@ | ||
542 | ||
543 | assert path == os.path.join('2015-12-Dec','Sunnyvale'), path |
|
544 | ||
545 | def test_parse_folder_name_default(): |
|
546 | if hasattr(load_config, 'config'): |
|
547 | del load_config.config |
|
548 | filesystem = FileSystem() |
|
549 | place_name = {'default': u'California', 'country': u'United States of America', 'state': u'California', 'city': u'Sunnyvale'} |
|
550 | mask = '%city' |
|
551 | location_parts = re.findall('(%[^%]+)', mask) |
|
552 | path = filesystem.parse_mask_for_location(mask, location_parts, place_name) |
|
553 | if hasattr(load_config, 'config'): |
|
554 | del load_config.config |
|
555 | ||
556 | assert path == 'Sunnyvale', path |
|
557 | ||
558 | def test_parse_folder_name_multiple(): |
|
559 | if hasattr(load_config, 'config'): |