def testLongTitle(self):
        self._loadAccounts(2)
        e = Action()
        e.tw_account = 'first-valid-account'
        executor = getMultiAdapter((self.folder, e, DummyEvent(self.folder.longtitle)),
                                   IExecutable)

        self.assertEquals(True, executor())
        self.assertTrue(len(persistentTwitter.getMessage()) < 140)

        status_msg = IStatusMessage(self.request).showStatusMessages()[0].message
        self.assertTrue(u'Tweet sent: ' in status_msg)
예제 #2
0
    def testLongTitle(self):
        self._loadAccounts(2)
        e = Action()
        e.tw_account = 'first-valid-account'
        executor = getMultiAdapter(
            (self.folder, e, DummyEvent(self.folder.longtitle)), IExecutable)

        self.assertEquals(True, executor())
        self.assertTrue(len(persistentTwitter.getMessage()) < 140)

        status_msg = IStatusMessage(
            self.request).showStatusMessages()[0].message
        self.assertTrue(u'Tweet sent: ' in status_msg)
예제 #3
0
    def testFirstValidAccount(self):
        self._loadAccounts(2)
        e = Action()
        e.tw_account = 'first-valid-account'
        executor = getMultiAdapter(
            (self.folder, e, DummyEvent(self.folder.doc1)), IExecutable)

        self.assertEquals(True, executor())
        self.assertEquals(persistentTwitter.getCredentials(),
                          ('consumer_key1', 'consumer_secret1',
                           'access_token_key1', 'access_token_secret1'))

        self.assertTrue('Doc 1\n' in persistentTwitter.getMessage())

        status_msg = IStatusMessage(
            self.request).showStatusMessages()[0].message
        self.assertTrue(u'Tweet sent: Doc 1\n' in status_msg)
    def testInvalidAccount(self):
        e = Action()
        e.tw_account = 'account'
        executor = getMultiAdapter((self.folder, e, DummyEvent(self.folder.error)),
                                   IExecutable)

        self.assertEquals(True, executor())

        self.assertEquals(persistentTwitter.getCredentials(),
                          ('', '', '', ''))

        self.assertTrue('' in persistentTwitter.getMessage())

        status_msg = IStatusMessage(self.request).showStatusMessages()[0].message
        self.assertEquals(status_msg,
                          (u"Could not publish to twitter, seems the account "
                            "account was removed from the list of authorized "
                            "accounts for this site."))
    def testFirstValidAccount(self):
        self._loadAccounts(2)
        e = Action()
        e.tw_account = 'first-valid-account'
        executor = getMultiAdapter((self.folder, e, DummyEvent(self.folder.doc1)),
                                   IExecutable)

        self.assertEquals(True, executor())
        self.assertEquals(persistentTwitter.getCredentials(),
                          ('consumer_key1', 
                           'consumer_secret1', 
                           'access_token_key1', 
                           'access_token_secret1'))

        self.assertTrue('Doc 1\n' in persistentTwitter.getMessage())

        status_msg = IStatusMessage(self.request).showStatusMessages()[0].message
        self.assertTrue(u'Tweet sent: Doc 1\n' in status_msg)
예제 #6
0
    def testInvalidAccount(self):
        e = Action()
        e.tw_account = 'account'
        executor = getMultiAdapter(
            (self.folder, e, DummyEvent(self.folder.error)), IExecutable)

        self.assertEquals(True, executor())

        self.assertEquals(persistentTwitter.getCredentials(), ('', '', '', ''))

        self.assertTrue('' in persistentTwitter.getMessage())

        status_msg = IStatusMessage(
            self.request).showStatusMessages()[0].message
        self.assertEquals(status_msg,
                          (u"Could not publish to twitter, seems the account "
                           "account was removed from the list of authorized "
                           "accounts for this site."))