def test_whitelist_param_just_a_string(self): with self.assert_initialization_fails(): NameWhitelistProcessor('foobar')
def test_whitelist_param_is_none(self): with self.assert_initialization_fails(): NameWhitelistProcessor(None)
def test_whitelist_param_not_iterable(self): with self.assert_initialization_fails(): NameWhitelistProcessor(10)
def test_no_whitelist_param(self): with self.assert_initialization_fails(): NameWhitelistProcessor()
def test_empty_whitelist(self): whitelist = NameWhitelistProcessor(whitelist=[]) with self.assertRaises(EventEmissionExit): whitelist({'name': sentinel.not_allowed_event})
def test_allowed_event(self): whitelist = NameWhitelistProcessor(whitelist=[sentinel.allowed_event]) self.assert_event_passed_through(whitelist, {'name': sentinel.allowed_event})
def test_filtering_out(self): whitelist = NameWhitelistProcessor(whitelist=[sentinel.allowed_event]) with self.assertRaises(EventEmissionExit): whitelist({'name': sentinel.not_allowed_event})