コード例 #1
0
    def test_pushcontent_insert_ignore(self, mock_transaction):
        request = {'request': 1, 'push': 1}
        response = self.fetch('/addrequest',
                              method='POST',
                              body=urllib.urlencode(request))
        T.assert_equal(response.error, None)
        T.assert_equal(mock_transaction.call_count, 1)

        # Extract the string of the prefix of the insert query
        insert_ignore_clause = mock_transaction.call_args[0][0][0]
        T.assert_is(type(insert_ignore_clause), db.InsertIgnore)
コード例 #2
0
    def test_pushcontent_insert_ignore(self, mock_transaction):
        request = { 'request': 1, 'push': 1 }
        response = self.fetch(
            '/addrequest',
            method='POST',
            body=urllib.urlencode(request)
        )
        T.assert_equal(response.error, None)
        T.assert_equal(mock_transaction.call_count, 1)

        # Extract the string of the prefix of the insert query
        insert_ignore_clause = mock_transaction.call_args[0][0][0]
        T.assert_is(type(insert_ignore_clause), db.InsertIgnore)
コード例 #3
0
    def test_send_notifications_empty_user_list(self):
        """If there is no pending push request we'll only send IRC and
        email notifications, but not XMPP messages."""
        self.people = []
        self.pushurl = "fake_push_url"
        self.pushtype = "fake_puth_type"

        with self.mocked_notifications() as (mocked_call, mocked_mail, mocked_xmpp):
            send_notifications(self.people, self.pushtype, self.pushurl)
            mocked_call.assert_called_once_with([
                '/nail/sys/bin/nodebot',
                '-i',
                Settings['irc']['nickname'],
                Settings['irc']['channel'],
                mock.ANY, # msg
            ])
            mocked_mail.assert_called_once_with(
                Settings['mail']['notifyall'],
                mock.ANY, # msg
                mock.ANY, # subject
            )
            T.assert_is(mocked_xmpp.called, False)