Exemplo n.º 1
0
    def test_setting_a_key_does_not_set_it_on_flask_config_if_outside_app_context(self):

        ckan_config[u'ckan.site_title'] = u'Example title'

        app = helpers._get_test_app()
        with app.flask_app.app_context():

            neq_(flask.current_app.config[u'ckan.site_title'], u'Example title')
Exemplo n.º 2
0
    def test_setting_a_key_does_not_set_it_on_flask_config_if_outside_app_context(
            self):

        ckan_config[u'ckan.site_title'] = u'Example title'

        app = helpers._get_test_app()
        with app.flask_app.app_context():

            neq_(flask.current_app.config[u'ckan.site_title'],
                 u'Example title')
 def test_calculate_versions_capacity_paginate(self):
     self.pill.prefix = 'single-paginate'
     f = 'hello_python'
     neq_(
         0,
         lambda_function.calculate_versions_capacity(function_name=f,
                                                     max_items=1))
     eq_(
         6143382,
         lambda_function.calculate_versions_capacity(function_name=f,
                                                     max_items=1))
Exemplo n.º 4
0
def test_compare_priority():
    data = [s[0] for s in sorted(ck.STATUS_PRIORITY.iteritems(), key=itemgetter(1))]
    for priority in data:
        for lesser in data[:data.index(priority)]:
            test.eq_(ck.compare_priority(lesser, priority), -1)
            test.neq_(ck.compare_priority(lesser, priority), 0)
            test.neq_(ck.compare_priority(priority, lesser), 0)
            test.eq_(ck.compare_priority(priority, lesser), 1)
        test.eq_(ck.compare_priority(priority, priority), 0)
        for greater in data[(data.index(priority) + 1):]:
            test.eq_(ck.compare_priority(priority, greater), -1)
            test.neq_(ck.compare_priority(priority, greater), 0)
            test.neq_(ck.compare_priority(greater, priority), 0)
            test.eq_(ck.compare_priority(greater, priority), 1)
 def testMapper(self):
     dict = iso_19139_mapper({}, get_iso_values_dict_1())
     print(dict)
     eq_(dict['title'], {'fi': 'Testiaineisto'})
     assert {
         '@type': 'Person',
         'email': '*****@*****.**',
         'name': 'tekija1'
     } in dict['creator']
     assert {
         '@type': 'Organization',
         'email': '*****@*****.**',
         'name': {
             'fi': 'tekija2'
         }
     } in dict['creator']
     assert {
         'email': '*****@*****.**',
         'member_of': {
             '@type': 'Organization',
             'name': {
                 'fi': 'omistaja_org'
             }
         },
         '@type': 'Person',
         'name': 'omistaja'
     } in dict['rights_holder']
     assert {
         '@type': 'Organization',
         'email': '*****@*****.**',
         'name': {
             'fi': 'jotainmuuta'
         }
     } not in dict['creator']
     assert {
         '@type': 'Organization',
         'email': '*****@*****.**',
         'name': {
             'fi': 'tekija1'
         }
     } not in dict['curator']
     assert {
         '@type': 'Organization',
         'email': '*****@*****.**',
         'name': {
             'fi': 'tekija2'
         }
     } not in dict['curator']
     assert {
         '@type': 'Organization',
         'email': '*****@*****.**',
         'name': {
             'fi': 'kuratoija'
         }
     } in dict['curator']
     self.assertDictEqual(
         {
             '@type': 'Organization',
             'email': '*****@*****.**',
             'name': {
                 'fi': 'jakelija'
             }
         }, dict['publisher'])
     neq_(
         {
             '@type': 'Organization',
             'email': '*****@*****.**',
             'name': {
                 'fi': 'julkaisija'
             }
         }, dict['publisher'])
     eq_(dict['language'], [{
         'identifier': 'http://lexvo.org/id/iso639-3/fin'
     }])
     assert 'testiavainsana' in dict['keyword']
     eq_(
         'POLYGON((21.193932 59.880178,21.193932 60.87458,23.154996 60.87458,23.154996 59.880178,21.193932 59.880178))',
         dict['spatial'][0]['as_wkt'][0])
     eq_('2017-01-01', dict['issued'])
     eq_('joopajoo', dict['access_rights']['description']['fi'])
     eq_('2000-01-01T00:00:00-00:00', dict['temporal'][0]['start_date'])
     eq_('2001-01-01T23:59:59-00:00', dict['temporal'][0]['end_date'])
     eq_('2017-06-06T00:00:00-00:00', dict['modified'])
     self.assertDictEqual(dict['provenance'][0],
                          {'description': {
                              'fi': 'provenance'
                          }})
Exemplo n.º 6
0
def test_timeout(): # pragma: no cover
        for x in range(1000):
            print('index=', x)
            neq_(   EasyProcess('sleep 5').call(timeout=0.05).return_code, 0)
 def test_calculate_versions_capacity_paginate(self):
     self.pill.prefix = 'single-paginate'
     f = 'hello_python'
     neq_(0, lambda_function.calculate_versions_capacity(function_name=f, max_items=1))
     eq_(6143382, lambda_function.calculate_versions_capacity(function_name=f, max_items=1))
 def test_calculate_versions_capacity(self):
     self.pill.prefix = 'single'
     f = 'hello_python'
     neq_(0, lambda_function.calculate_versions_capacity(function_name=f))
     eq_(6143382, lambda_function.calculate_versions_capacity(function_name=f))
 def test_calculate_capacity_paginate(self):
     self.pill.prefix = 'paginate'
     neq_(1236380, lambda_function.calculate_capacity(max_items=3))
     eq_(7379387, lambda_function.calculate_capacity(max_items=3))
 def test_calculate_capacity(self):
     neq_(1236380, lambda_function.calculate_capacity())
     eq_(7379387, lambda_function.calculate_capacity())
Exemplo n.º 11
0
def test_timeout():  # pragma: no cover
    for x in range(1000):
        print('index=', x)
        neq_(EasyProcess('sleep 5').call(timeout=0.05).return_code, 0)
 def test_calculate_versions_capacity(self):
     self.pill.prefix = 'single'
     f = 'hello_python'
     neq_(0, lambda_function.calculate_versions_capacity(function_name=f))
     eq_(6143382,
         lambda_function.calculate_versions_capacity(function_name=f))
 def test_calculate_capacity_paginate(self):
     self.pill.prefix = 'paginate'
     neq_(1236380, lambda_function.calculate_capacity(max_items=3))
     eq_(7379387, lambda_function.calculate_capacity(max_items=3))
 def test_calculate_capacity(self):
     neq_(1236380, lambda_function.calculate_capacity())
     eq_(7379387, lambda_function.calculate_capacity())