def test___str__(self): s = slack.Slack(None, name='test') d = slack.SlackDest(s, 'user', {'name': 'fred'}) self.assertEqual('fred', str(d)) e = slack.SlackDest(s, 'im', {'name': 'fred', 'user': '******'}) s.users['FRED0'] = {'name': 'Fred'} self.assertEqual('@Fred', str(e))
def test(self): s = slack.Slack(None, name='test') s.dests['FOO'] = slack.SlackDest(s, 'channel', { 'id': 'FOO', 'name': 'foo', 'is_member': True, }) a = slack.SlackAddress(s, 'FOO') self.assertEqual('test; #foo', str(a)) self.assertEqual('#foo', a.short())
def test_destinations_senders(self): s = slack.Slack(None, name='test') s.dests = {'foo': slack.SlackDest(s, 'user', {'name': 'bar'})} self.assertEqual({'test; bar'}, s.destinations()) self.assertEqual({'test; bar'}, s.senders())
def test___repr__(self): s = slack.Slack(None, name='test') d = slack.SlackDest(s, 'user', {'name': 'fred'}) self.assertEqual( "SlackDest(\n 'user',\n {'name': 'fred'}\n )", repr(d))
def test_update(self): s = slack.Slack(None, name='test') d = slack.SlackDest(s, 'user', {'name': 'fred'}) d.update({'flig': 'quoz'}) self.assertEqual(dict(name='fred', flig='quoz'), d.data)