示例#1
0
 def setUp(self):
     self.fish_section_title = u"Oh fishy fishy fishy fishy fishy fish"
     self.forest_section_title = u"Forests are totes awesome"
     self.pmq_section_title = "Questions on 20 June 2014"
     # Make sure that the default SayIt instance exists, since when
     # testing it won't be created because of SOUTH_TESTS_MIGRATE = False
     default_instance, _ = Instance.objects.get_or_create(label='default')
     create_sections([
         {
             'title': u"Committee Minutes",
             'subsections': [
                 {   'title': u"Agriculture, Forestry and Fisheries",
                     'subsections': [
                         {   'title': u"16 November 2012",
                             'subsections': [
                                 {   'title': self.fish_section_title,
                                     'speeches': [ 7, date(2013, 2, 18), time(12, 0) ],
                                 },
                                 {
                                     'title': u"Empty section",
                                 }
                             ],
                         },
                         {   'title': "17 November 2012",
                             'subsections': [
                                 {   'title': self.forest_section_title,
                                     'speeches': [ 7, date(2013, 2, 19), time(9, 0), False ],
                                 },
                                 {
                                     'title': "Empty section",
                                 }
                             ],
                         },
                     ],
                 },
             ],
         },
         {
             'title': u"Hansard",
             'subsections': [
                 {   'title': u"Prime Minister's Questions",
                     'subsections': [
                         {   'title': self.pmq_section_title,
                             'speeches': [ 7, date(2013, 2, 18), time(12, 0) ],
                         },
                     ],
                 },
             ],
         },
     ], instance=default_instance)
示例#2
0
 def setUp(self):
     self.fish_section_title = u"Oh fishy fishy fishy fishy fishy fish"
     self.forest_section_title = u"Forests are totes awesome"
     self.pmq_section_title = "Questions on 20 June 2014"
     # Make sure that the default SayIt instance exists, since when
     # testing it won't be created because of SOUTH_TESTS_MIGRATE = False
     default_instance, _ = Instance.objects.get_or_create(label='default')
     create_sections([
         {
             'title': u"Committee Minutes",
             'subsections': [
                 {   'title': u"Agriculture, Forestry and Fisheries",
                     'subsections': [
                         {   'title': u"16 November 2012",
                             'subsections': [
                                 {   'title': self.fish_section_title,
                                     'speeches': [ 7, date(2013, 2, 18), time(12, 0) ],
                                 },
                                 {
                                     'title': u"Empty section",
                                 }
                             ],
                         },
                         {   'title': "17 November 2012",
                             'subsections': [
                                 {   'title': self.forest_section_title,
                                     'speeches': [ 7, date(2013, 2, 19), time(9, 0), False ],
                                 },
                                 {
                                     'title': "Empty section",
                                 }
                             ],
                         },
                     ],
                 },
             ],
         },
         {
             'title': u"Hansard",
             'subsections': [
                 {   'title': u"Prime Minister's Questions",
                     'subsections': [
                         {   'title': self.pmq_section_title,
                             'speeches': [ 7, date(2013, 2, 18), time(12, 0) ],
                         },
                     ],
                 },
             ],
         },
     ], instance=default_instance)
示例#3
0
 def setUp(self):
     create_sections([
         {
             'title': u"Hansard",
             'subsections': [
                 {   'title': u"2013",
                     'subsections': [
                         {   'title': u"02",
                             'subsections': [
                                 {   'title': u"16",
                                     'subsections': [
                                         {   'title': u"Proceedings of the National Assembly (2012/2/16)",
                                             'subsections': [
                                                 {   'title': u"Proceedings of Foo",
                                                     'speeches': [ 4, date(2013, 2, 16), time(9, 0) ],
                                                 },
                                                 {   'title': u"Bill on Silly Walks",
                                                     'speeches': [ 2, date(2013, 2, 16), time(12, 0) ],
                                                 },
                                             ],
                                         },
                                     ],
                                 },
                                 {
                                     'title': u"18",
                                     'subsections': [
                                         {   'title': u"Proceedings of the National Assembly (2012/2/18)",
                                             'subsections': [
                                                 {   'title': u"Budget Report",
                                                     'speeches': [ 3, date(2013, 2, 18), time(9, 0) ],
                                                 },
                                                 {   'title': u"Bill on Comedy Mustaches",
                                                     'speeches': [ 7, date(2013, 2, 18), time(12, 0) ],
                                                 },
                                             ],
                                         },
                                     ],
                                 },
                             ],
                         },
                         {
                             'title': u"Empty section",
                         }
                     ],
                 },
             ],
         },
     ])
示例#4
0
 def setUp(self):
     create_sections([
         {
             'title': u"Hansard",
             'subsections': [
                 {   'title': u"2013",
                     'subsections': [
                         {   'title': u"02",
                             'subsections': [
                                 {   'title': u"16",
                                     'subsections': [
                                         {   'title': u"Proceedings of the National Assembly (2012/2/16)",
                                             'subsections': [
                                                 {   'title': u"Proceedings of Foo",
                                                     'speeches': [ 4, date(2013, 2, 16), time(9, 0) ],
                                                 },
                                                 {   'title': u"Bill on Silly Walks",
                                                     'speeches': [ 2, date(2013, 2, 16), time(12, 0) ],
                                                 },
                                             ],
                                         },
                                     ],
                                 },
                                 {
                                     'title': u"18",
                                     'subsections': [
                                         {   'title': u"Proceedings of the National Assembly (2012/2/18)",
                                             'subsections': [
                                                 {   'title': u"Budget Report",
                                                     'speeches': [ 3, date(2013, 2, 18), time(9, 0) ],
                                                 },
                                                 {   'title': u"Bill on Comedy Mustaches",
                                                     'speeches': [ 7, date(2013, 2, 18), time(12, 0) ],
                                                 },
                                             ],
                                         },
                                     ],
                                 },
                             ],
                         },
                         {
                             'title': u"Empty section",
                         }
                     ],
                 },
             ],
         },
     ])
示例#5
0
 def setUp(self):
     create_sections([
         { 'heading': "Government Debates", 'subsections': [
             { 'heading': "Monday 25th March", 'subsections': [
                 { 'heading': "Oral Answers to Questions - Silly Walks",
                   'speeches': [ 4, date(2013, 3, 25), time(9, 0) ],
                 },
                 { 'heading': "Bill on Silly Walks",
                   'speeches': [ 2, date(2013, 3, 25), time(12, 0) ],
                 },
             ] },
             { 'heading': "Friday 29th March", 'subsections': [
                 { 'heading': "Fixed Easter Bill", 'subsections': [
                     { 'heading': "Z Clause",
                       'speeches': [ 2, date(2013, 3, 29), time(15, 00) ],
                     },
                     { 'heading': "Clause 1",
                       'speeches': [ 3, date(2013, 3, 29), time(14, 30) ],
                     },
                     { 'heading': "New Clause 1",
                       'speeches': [ 3, date(2013, 3, 29), time(14, 0) ],
                     },
                 ] },
             ] },
         ] },
         { 'heading': "Government Written Answers", 'subsections': [
             { 'heading': "Ministry of Aardvarks", 'subsections': [
                 { 'heading': "March",
                   'speeches': [ 3, None, None ],
                 },
             ] },
             { 'heading': "Ministry of Silly Walks", 'subsections': [
                 { 'heading': "Wednesday 6th of March",
                   'speeches': [ 1, date(2013, 3, 6), None ],
                 },
                 { 'heading': "Thursday 7th of March",
                   'speeches': [ 2, date(2013, 3, 7), None ],
                 },
             ] },
             { 'heading': "Ministry of Something Else"
             },
         ] },
     ])
示例#6
0
    def setUp(self):
        fixtures = os.path.join(os.path.abspath(south_africa.__path__[0]), 'fixtures')
        popolo_path = os.path.join(fixtures, 'test-popolo.json')
        call_command('core_import_popolo',
            popolo_path,
            commit=True)

        # TODO rewrite this kludge, pending https://github.com/mysociety/popit-django/issues/19
        popolo_io = open(popolo_path, 'r')
        popolo_json = json.load(popolo_io)
        collection_url = 'http://popit.example.com/api/v0.1/'

        api_instance = ApiInstance(url = collection_url)
        api_instance.save()

        for doc in popolo_json['persons']:
            # Add id and url to the doc
            doc['popit_id']  = doc['id']
            url = collection_url + doc['id']
            doc['popit_url'] = url

            person = PopitPerson.update_from_api_results(instance=api_instance, doc=doc)

            instance, _ = Instance.objects.get_or_create(
                label='default',
                defaults = {
                    'title': 'An instance'
                })

            Speaker.objects.create(
                instance = instance,
                name = doc['name'],
                person = person)

        # Create the top level SayIt sections, so that there's no
        # warning when getting the person page:
        create_sections([{'title': u"Hansard"},
                         {'title': u"Committee Minutes"},
                         {'title': u"Questions"}])
示例#7
0
文件: tests.py 项目: tmtmtmtm/pombola
 def setUp(self):
     create_sections([
         {
             'title': "Committee Minutes",
             'subsections': [
                 {   'title': "Agriculture, Forestry and Fisheries",
                     'subsections': [
                         {   'title': "16 November 2012",
                             'subsections': [
                                 {   'title': "Oh fishy fishy fishy fishy fishy fish",
                                     'speeches': [ 7, date(2013, 2, 18), time(12, 0) ],
                                 },
                                 {
                                     'title': "Empty section",
                                 }
                             ],
                         },
                     ],
                 },
             ],
         },
     ])
示例#8
0
    def setUp(self):
        fixtures = os.path.join(os.path.abspath(south_africa.__path__[0]), 'fixtures')
        popolo_path = os.path.join(fixtures, 'test-popolo.json')
        call_command('core_import_popolo',
            popolo_path,
            commit=True)

        # TODO rewrite this kludge, pending https://github.com/mysociety/popit-django/issues/19
        popolo_io = open(popolo_path, 'r')
        popolo_json = json.load(popolo_io)
        collection_url = 'http://popit.example.com/api/v0.1/'

        api_instance = ApiInstance(url = collection_url)
        api_instance.save()

        for doc in popolo_json['persons']:
            # Add id and url to the doc
            doc['popit_id']  = doc['id']
            url = collection_url + doc['id']
            doc['popit_url'] = url

            person = PopitPerson.update_from_api_results(instance=api_instance, doc=doc)

            instance, _ = Instance.objects.get_or_create(
                label='default',
                defaults = {
                    'title': 'An instance'
                })

            Speaker.objects.create(
                instance = instance,
                name = doc['name'],
                person = person)

        # Create the top level SayIt sections, so that there's no
        # warning when getting the person page:
        create_sections([{'title': u"Hansard"},
                         {'title': u"Committee Minutes"},
                         {'title': u"Questions"}])
示例#9
0
 def setUp(self):
     create_sections([
         {
             'heading':
             "Government Debates",
             'subsections': [
                 {
                     'heading':
                     "Monday 25th March",
                     'subsections': [
                         {
                             'heading':
                             "Oral Answers to Questions - Silly Walks",
                             'speeches': [4,
                                          date(2013, 3, 25),
                                          time(9, 0)],
                         },
                         {
                             'heading': "Bill on Silly Walks",
                             'speeches':
                             [2, date(2013, 3, 25),
                              time(12, 0)],
                         },
                     ]
                 },
                 {
                     'heading':
                     "Friday 29th March",
                     'subsections': [
                         {
                             'heading':
                             "Fixed Easter Bill",
                             'subsections': [
                                 {
                                     'heading':
                                     "Z Clause",
                                     'speeches':
                                     [2, date(2013, 3, 29),
                                      time(15, 00)],
                                 },
                                 {
                                     'heading':
                                     "Clause 1",
                                     'speeches':
                                     [3, date(2013, 3, 29),
                                      time(14, 30)],
                                 },
                                 {
                                     'heading':
                                     "New Clause 1",
                                     'speeches':
                                     [3, date(2013, 3, 29),
                                      time(14, 0)],
                                 },
                             ]
                         },
                     ]
                 },
             ]
         },
         {
             'heading':
             "Government Written Answers",
             'subsections': [
                 {
                     'heading':
                     "Ministry of Aardvarks",
                     'subsections': [
                         {
                             'heading': "March",
                             'speeches': [3, None, None],
                         },
                     ]
                 },
                 {
                     'heading':
                     "Ministry of Silly Walks",
                     'subsections': [
                         {
                             'heading': "Wednesday 6th of March",
                             'speeches': [1, date(2013, 3, 6), None],
                         },
                         {
                             'heading': "Thursday 7th of March",
                             'speeches': [2, date(2013, 3, 7), None],
                         },
                     ]
                 },
                 {
                     'heading': "Ministry of Something Else"
                 },
             ]
         },
     ])