Пример #1
0
 def test_unavailable_bitrate_setting_returns_error(self):
     result = setting_utils.validate_settings(
         self.defaults, {'SPOTIFY_BITRATE': 50})
     self.assertEqual(
         result['SPOTIFY_BITRATE'],
         'Unavailable Spotify bitrate. '
         'Available bitrates are 96, 160, and 320.')
Пример #2
0
 def test_deprecated_setting_value_returns_error(self):
     result = validate_settings(self.defaults,
         {'BACKENDS': ('mopidy.backends.despotify.DespotifyBackend',)})
     self.assertEqual(result['BACKENDS'],
         u'Deprecated setting value. ' +
         '"mopidy.backends.despotify.DespotifyBackend" is no longer ' +
         'available.')
Пример #3
0
 def test_noniterable_multivalue_setting_returns_error(self):
     result = setting_utils.validate_settings(
         self.defaults, {'FRONTENDS': ('this is not a tuple')})
     self.assertEqual(
         result['FRONTENDS'],
         'Must be a tuple. '
         "Remember the comma after single values: (u'value',)")
Пример #4
0
 def test_deprecated_setting_value_returns_error(self):
     result = setting_utils.validate_settings(
         self.defaults,
         {'BACKENDS': ('mopidy.backends.despotify.DespotifyBackend', )})
     self.assertEqual(
         result['BACKENDS'], u'Deprecated setting value. ' +
         '"mopidy.backends.despotify.DespotifyBackend" is no longer ' +
         'available.')
Пример #5
0
 def test_unknown_setting_returns_error(self):
     result = validate_settings(self.defaults,
         {'MPD_SERVER_HOSTNMAE': '127.0.0.1'})
     self.assertEqual(result['MPD_SERVER_HOSTNMAE'],
         u'Unknown setting. Is it misspelled?')
Пример #6
0
 def test_no_errors_yields_empty_dict(self):
     result = validate_settings(self.defaults, {})
     self.assertEqual(result, {})
Пример #7
0
 def test_empty_backends_list_returns_error(self):
     result = setting_utils.validate_settings(
         self.defaults, {'BACKENDS': []})
     self.assertEqual(
         result['BACKENDS'], 'Must contain at least one value.')
Пример #8
0
 def test_two_errors_are_both_reported(self):
     result = setting_utils.validate_settings(
         self.defaults, {'FOO': '', 'BAR': ''})
     self.assertEqual(len(result), 2)
Пример #9
0
 def test_custom_settings_does_not_return_errors(self):
     result = setting_utils.validate_settings(
         self.defaults, {'CUSTOM_MYAPP_SETTING': 'foobar'})
     self.assertNotIn('CUSTOM_MYAPP_SETTING', result)
Пример #10
0
 def test_unknown_setting_returns_error(self):
     result = setting_utils.validate_settings(
         self.defaults, {'MPD_SERVER_HOSTNMAE': '127.0.0.1'})
     self.assertEqual(
         result['MPD_SERVER_HOSTNMAE'],
         'Unknown setting. Did you mean MPD_SERVER_HOSTNAME?')
Пример #11
0
 def test_no_errors_yields_empty_dict(self):
     result = setting_utils.validate_settings(self.defaults, {})
     self.assertEqual(result, {})
Пример #12
0
 def test_noniterable_multivalue_setting_returns_error(self):
     result = setting_utils.validate_settings(
         self.defaults, {'FRONTENDS': ('this is not a tuple')})
     self.assertEqual(
         result['FRONTENDS'], 'Must be a tuple. '
         "Remember the comma after single values: (u'value',)")
Пример #13
0
 def test_empty_frontends_list_returns_error(self):
     result = setting_utils.validate_settings(self.defaults,
                                              {'FRONTENDS': []})
     self.assertEqual(result['FRONTENDS'], 'Must be set.')
Пример #14
0
 def test_unknown_setting_returns_error(self):
     result = validate_settings(self.defaults,
                                {'MPD_SERVER_HOSTNMAE': '127.0.0.1'})
     self.assertEqual(result['MPD_SERVER_HOSTNMAE'],
                      u'Unknown setting. Is it misspelled?')
Пример #15
0
 def test_not_renamed_setting_returns_error(self):
     result = validate_settings(self.defaults,
         {'SERVER_HOSTNAME': '127.0.0.1'})
     self.assertEqual(result['SERVER_HOSTNAME'],
         u'Deprecated setting. Use MPD_SERVER_HOSTNAME.')
Пример #16
0
 def test_not_renamed_setting_returns_error(self):
     result = setting_utils.validate_settings(
         self.defaults, {'SERVER_HOSTNAME': '127.0.0.1'})
     self.assertEqual(
         result['SERVER_HOSTNAME'],
         'Deprecated setting. Use MPD_SERVER_HOSTNAME.')
Пример #17
0
 def test_unneeded_settings_returns_error(self):
     result = validate_settings(self.defaults,
         {'SPOTIFY_LIB_APPKEY': '/tmp/foo'})
     self.assertEqual(result['SPOTIFY_LIB_APPKEY'],
         u'Deprecated setting. It may be removed.')
Пример #18
0
 def test_unneeded_settings_returns_error(self):
     result = setting_utils.validate_settings(
         self.defaults, {'SPOTIFY_LIB_APPKEY': '/tmp/foo'})
     self.assertEqual(
         result['SPOTIFY_LIB_APPKEY'],
         'Deprecated setting. It may be removed.')
Пример #19
0
 def test_two_errors_are_both_reported(self):
     result = validate_settings(self.defaults,
         {'FOO': '', 'BAR': ''})
     self.assertEqual(len(result), 2)
Пример #20
0
 def test_empty_frontends_list_returns_error(self):
     result = setting_utils.validate_settings(
         self.defaults, {'FRONTENDS': []})
     self.assertEqual(
         result['FRONTENDS'], 'Must be set.')