コード例 #1
0
 def test_default_if_none(self):
     settings.PUSH_NOTIFICATIONS_SETTINGS['TEST'] = 'test'
     settings.PUSH_NOTIFICATIONS_SETTINGS['TESTS'] = {
         'qwerty':'uiop',
         'qwerty2':None
     }
     assert dynamic._get_application_settings('qwerty','TEST','Test Exception') == 'uiop'
     assert dynamic._get_application_settings('qwerty2','TEST','Test Exception') == 'test'
コード例 #2
0
 def test_default_if_none(self):
     settings.PUSH_NOTIFICATIONS_SETTINGS['TEST'] = 'test'
     settings.PUSH_NOTIFICATIONS_SETTINGS['TESTS'] = {
         'qwerty': 'uiop',
         'qwerty2': None
     }
     assert dynamic._get_application_settings('qwerty', 'TEST',
                                              'Test Exception') == 'uiop'
     assert dynamic._get_application_settings('qwerty2', 'TEST',
                                              'Test Exception') == 'test'
コード例 #3
0
 def test_base_settings(self):
     settings.PUSH_NOTIFICATIONS_SETTINGS['TEST'] = 'test'
     assert dynamic._get_application_settings('qwerty','TEST','Test Exception') == 'test'
     settings.PUSH_NOTIFICATIONS_SETTINGS['TESTS'] = {
         'qwerty':'uiop'
     }
     assert dynamic._get_application_settings('qwerty','TEST','Test Exception') == 'uiop'
     assert dynamic._get_application_settings('uiop','TEST','Test Exception') == 'test'
     try:
         dynamic._get_application_settings('qwerty','NOTPRESENT','Test Exception')
         assert False
     except Exception as ex:
         assert type(ex) == ImproperlyConfigured
         assert ex.args and ex.args[0] == 'Test Exception'
コード例 #4
0
 def test_base_settings(self):
     settings.PUSH_NOTIFICATIONS_SETTINGS['TEST'] = 'test'
     assert dynamic._get_application_settings('qwerty', 'TEST',
                                              'Test Exception') == 'test'
     settings.PUSH_NOTIFICATIONS_SETTINGS['TESTS'] = {'qwerty': 'uiop'}
     assert dynamic._get_application_settings('qwerty', 'TEST',
                                              'Test Exception') == 'uiop'
     assert dynamic._get_application_settings('uiop', 'TEST',
                                              'Test Exception') == 'test'
     try:
         dynamic._get_application_settings('qwerty', 'NOTPRESENT',
                                           'Test Exception')
         assert False
     except Exception as ex:
         assert type(ex) == ImproperlyConfigured
         assert ex.args and ex.args[0] == 'Test Exception'
コード例 #5
0
 def test_database_settings(self):
     settings.PUSH_NOTIFICATIONS_SETTINGS['TEST'] = 'test'
     settings.PUSH_NOTIFICATIONS_SETTINGS['TESTS_MODEL'] = {
         'model':'push_notifications.ApplicationModel',
         'key':'application_id',
         'value':'gcm_api_key',
     }
     ApplicationModel.objects.create(application_id='qwerty2',gcm_api_key='uiop2')
     assert dynamic._get_application_settings('qwerty2','TEST','Test Exception') == 'uiop2'
     assert dynamic._get_application_settings('uiop2','TEST','Test Exception') == 'test'
     try:
         dynamic._get_application_settings('qwerty','NOTPRESENT','Test Exception')
         assert False
     except Exception as ex:
         assert type(ex) == ImproperlyConfigured
         assert ex.args and ex.args[0] == 'Test Exception'
コード例 #6
0
 def test_database_settings(self):
     settings.PUSH_NOTIFICATIONS_SETTINGS['TEST'] = 'test'
     settings.PUSH_NOTIFICATIONS_SETTINGS['TESTS_MODEL'] = {
         'model': 'push_notifications.ApplicationModel',
         'key': 'application_id',
         'value': 'gcm_api_key',
     }
     ApplicationModel.objects.create(application_id='qwerty2',
                                     gcm_api_key='uiop2')
     assert dynamic._get_application_settings('qwerty2', 'TEST',
                                              'Test Exception') == 'uiop2'
     assert dynamic._get_application_settings('uiop2', 'TEST',
                                              'Test Exception') == 'test'
     try:
         dynamic._get_application_settings('qwerty', 'NOTPRESENT',
                                           'Test Exception')
         assert False
     except Exception as ex:
         assert type(ex) == ImproperlyConfigured
         assert ex.args and ex.args[0] == 'Test Exception'