Esempio n. 1
0
 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))
Esempio n. 2
0
    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())
Esempio n. 3
0
 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())
Esempio n. 4
0
 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))
Esempio n. 5
0
 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)