OLD | NEW |
1 # Copyright 2012, 2013 Canonical Ltd. This software is licensed under the | 1 # Copyright 2012, 2013 Canonical Ltd. This software is licensed under the |
2 # GNU Affero General Public License version 3 (see the file LICENSE). | 2 # GNU Affero General Public License version 3 (see the file LICENSE). |
3 | 3 |
4 """Helpers to generate test data for use.""" | 4 """Helpers to generate test data for use.""" |
5 | 5 |
6 from bzrlib.bzrdir import BzrDir | 6 from bzrlib.bzrdir import BzrDir |
7 from contextlib import contextmanager | 7 from contextlib import contextmanager |
8 from calendar import timegm | 8 from calendar import timegm |
9 from datetime import ( | 9 from datetime import ( |
10 date, | 10 date, |
(...skipping 690 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
701 (u'Fail gracefully if upstream source goes missing', 1, u''), | 701 (u'Fail gracefully if upstream source goes missing', 1, u''), |
702 (u'Contain a suite of tests with the charm that pass', 1, u''), | 702 (u'Contain a suite of tests with the charm that pass', 1, u''), |
703 (u'Passes tests from Jenkins on jujucharms.com', 1, u''), | 703 (u'Passes tests from Jenkins on jujucharms.com', 1, u''), |
704 ] | 704 ] |
705 ) | 705 ) |
706 | 706 |
707 category_dict = { | 707 category_dict = { |
708 'name': category[0], | 708 'name': category[0], |
709 'description': category[1], | 709 'description': category[1], |
710 'questions': [{ | 710 'questions': [{ |
711 'id': hashlib.md5(q[0]).hexdigest(), | 711 'id': hashlib.md5(question[0]).hexdigest(), |
712 'description': q[0], | 712 'description': question[0], |
713 'points': q[1], | 713 'points': question[1], |
714 'extended_description': q[2] | 714 'extended_description': question[2], |
715 } for q in category[2]] | 715 } for question in category[2]] |
716 } | 716 } |
717 | 717 |
718 return category_dict | 718 return category_dict |
719 | 719 |
720 | 720 |
721 def make_review_entry(**kwargs): | 721 def make_review_entry(**kwargs): |
722 """Create an entry for the review queue. | 722 """Create an entry for the review queue. |
723 | 723 |
724 keyword arguments override the defaults. | 724 keyword arguments override the defaults. |
725 """ | 725 """ |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
800 | 800 |
801 @contextmanager | 801 @contextmanager |
802 def bundle_branch(bundle_path=None, extra=[]): | 802 def bundle_branch(bundle_path=None, extra=[]): |
803 """Create a Bazaar branch from the files in bundle_path.""" | 803 """Create a Bazaar branch from the files in bundle_path.""" |
804 # Avoid circular imports. | 804 # Avoid circular imports. |
805 if bundle_path is None: | 805 if bundle_path is None: |
806 bundle_path = os.path.split(__file__)[0] | 806 bundle_path = os.path.split(__file__)[0] |
807 bundle_path = os.path.join(bundle_path, 'data/sample_bundle') | 807 bundle_path = os.path.join(bundle_path, 'data/sample_bundle') |
808 with _sample_branch(bundle_path, extra) as (branch_dir, rev): | 808 with _sample_branch(bundle_path, extra) as (branch_dir, rev): |
809 yield branch_dir, rev, bundle_path | 809 yield branch_dir, rev, bundle_path |
OLD | NEW |