Esempio n. 1
0
    def test_validate_account_config_returns_false_if_any_account_info_is_missing(
            self):
        validator = ConfigValidator(account={
            'CLIENT_ID': 'id',
            'CLIENT_SECRET': 'secret',
            'REDIRECT_URI': 'uri'
        })
        self.assertFalse(validator.validate_account_config())

        validator = ConfigValidator(account={
            'CLIENT_ID': 'id',
            'CLIENT_SECRET': 'secret',
            'USERNAME': '******'
        })
        self.assertFalse(validator.validate_account_config())

        validator = ConfigValidator(account={
            'CLIENT_ID': 'id',
            'USERNAME': '******',
            'REDIRECT_URI': 'uri'
        })
        self.assertFalse(validator.validate_account_config())

        validator = ConfigValidator(
            account={
                'CLIENT_SECRET': 'secret',
                'USERNAME': '******',
                'REDIRECT_URI': 'uri'
            })
        self.assertFalse(validator.validate_account_config())
Esempio n. 2
0
 def test_validate_account_config_returns_true_if_all_account_info_is_set(
         self):
     validator = ConfigValidator(
         account={
             'CLIENT_ID': 'id',
             'CLIENT_SECRET': 'secret',
             'REDIRECT_URI': 'uri',
             'USERNAME': '******'
         })
     self.assertTrue(validator.validate_account_config())
Esempio n. 3
0
 def test_is_valid_returns_false_if_account_config_is_invalid(self):
     validator = ConfigValidator(playlist={}, log={}, account={})
     validator.validate_playlist_config = Mock(return_value=True)
     validator.validate_log_config = Mock(return_value=True)
     validator.validate_account_config = Mock(return_value=False)
     self.assertFalse(validator.is_valid())
Esempio n. 4
0
 def test_is_valid_returns_true_if_all_config_types_are_valid(self):
     validator = ConfigValidator(playlist={}, log={}, account={})
     validator.validate_playlist_config = Mock(return_value=True)
     validator.validate_log_config = Mock(return_value=True)
     validator.validate_account_config = Mock(return_value=True)
     self.assertTrue(validator.is_valid())