diff -Nru twisted-news-11.0.0/debian/changelog twisted-news-12.1.0/debian/changelog --- twisted-news-11.0.0/debian/changelog 2011-04-18 20:56:36.000000000 +0000 +++ twisted-news-12.1.0/debian/changelog 2012-06-19 23:07:37.000000000 +0000 @@ -1,3 +1,23 @@ +twisted-news (12.1.0-1~ppa1~oneiric1) oneiric; urgency=low + + * New upstream version. + * Rebuild package for use in PPA. + + -- Jessica McKellar Tue, 19 Jun 2012 19:07:12 -0400 + +twisted-news (12.0.0-1~ppa1~oneiric1) oneiric; urgency=low + + * New upstream version. + * Rebuild package for use in PPA. + + -- Jessica McKellar Wed, 15 Feb 2012 20:44:25 -0500 + +twisted-news (11.1.0-1) unstable; urgency=low + + * New upstream release. + + -- Matthias Klose Wed, 21 Dec 2011 12:58:19 +0100 + twisted-news (11.0.0-1) unstable; urgency=low * New upstream release. diff -Nru twisted-news-11.0.0/debian/compat twisted-news-12.1.0/debian/compat --- twisted-news-11.0.0/debian/compat 2010-07-21 08:41:05.000000000 +0000 +++ twisted-news-12.1.0/debian/compat 2012-06-19 23:06:25.000000000 +0000 @@ -1 +1 @@ -5 +7 diff -Nru twisted-news-11.0.0/debian/control twisted-news-12.1.0/debian/control --- twisted-news-11.0.0/debian/control 2011-04-18 20:56:52.000000000 +0000 +++ twisted-news-12.1.0/debian/control 2012-06-19 23:06:48.000000000 +0000 @@ -3,17 +3,16 @@ Priority: optional Maintainer: Matthias Klose Uploaders: Free Ekanayaka -Build-Depends: debhelper (>= 5.0.37.1), python-all (>= 2.6.5-9~), python-twisted-core (>= 11.0), patch +Build-Depends: debhelper (>=7.0.50~), python-all (>= 2.6.6-3~), python-twisted-core (>= 12.1), patch XS-Python-Version: all -Standards-Version: 3.9.1 +Standards-Version: 3.9.2 Package: python-twisted-news Architecture: all -Depends: ${python:Depends}, python-twisted-core (>= 11.0), ${misc:Depends} +Depends: ${python:Depends}, python-twisted-core (>= 12.1), ${misc:Depends} Conflicts: python2.3-twisted-news, python2.4-twisted-news Replaces: python2.3-twisted-news, python2.4-twisted-news -XB-Python-Version: ${python:Versions} -Description: An NNTP protocol implementation with client and server +Description: NNTP protocol implementation with client and server Twisted News provides a very basic NNTP server, as well as an NNTP client protocol implementation. Two messages storage systems are supported: the DB-API 2.0 backend stores and indexes messages in any diff -Nru twisted-news-11.0.0/debian/rules twisted-news-12.1.0/debian/rules --- twisted-news-11.0.0/debian/rules 2010-07-21 08:43:21.000000000 +0000 +++ twisted-news-12.1.0/debian/rules 2012-06-19 23:06:25.000000000 +0000 @@ -7,6 +7,8 @@ VER := $(shell /usr/bin/python -c 'import sys; print sys.version[:3]') build: build-stamp +build-arch: build-stamp +build-indep: build-stamp build-stamp: $(PYVERS:%=build-python%) touch $@ build-python%: @@ -25,7 +27,7 @@ install-prereq: build-stamp dh_testdir dh_testroot - dh_clean -k + dh_prep install-python%: install-prereq : # python-twisted-news @@ -77,7 +79,6 @@ dh_testroot dh_installchangelogs -i dh_installdocs -i -A README -# dh_installdocs -ppython-twisted-news doc/examples doc/howto dh_installmenu -i dh_compress -i -X.py dh_fixperms -i diff -Nru twisted-news-11.0.0/debian/watch twisted-news-12.1.0/debian/watch --- twisted-news-11.0.0/debian/watch 2011-02-24 11:11:19.000000000 +0000 +++ twisted-news-12.1.0/debian/watch 2012-06-19 23:06:24.000000000 +0000 @@ -1,2 +1,2 @@ version=3 -http://tmrc.mit.edu/mirror/twisted/News/(\d+\.\d)/ TwistedNews-([\d\.]*)\.tar\.bz2 +http://tmrc.mit.edu/mirror/twisted/News/(\d\.\d)/ TwistedNews-([\d\.]*)\.tar\.bz2 diff -Nru twisted-news-11.0.0/LICENSE twisted-news-12.1.0/LICENSE --- twisted-news-11.0.0/LICENSE 2011-03-22 23:04:17.000000000 +0000 +++ twisted-news-12.1.0/LICENSE 2012-02-11 13:47:35.000000000 +0000 @@ -1,4 +1,4 @@ -Copyright (c) 2001-2011 +Copyright (c) 2001-2012 Allen Short Andy Gayton Andrew Bennetts @@ -12,7 +12,7 @@ Donovan Preston Eric Mangold Eyal Lotem -Itamar Shtull-Trauring +Itamar Turner-Trauring James Knight Jason A. Mobarak Jean-Paul Calderone diff -Nru twisted-news-11.0.0/NEWS twisted-news-12.1.0/NEWS --- twisted-news-11.0.0/NEWS 2011-04-02 01:10:15.000000000 +0000 +++ twisted-news-12.1.0/NEWS 2012-06-02 07:04:01.000000000 +0000 @@ -1,6 +1,33 @@ Ticket numbers in this file can be looked up by visiting http://twistedmatrix.com/trac/ticket/ +Twisted News 12.1.0 (2012-06-02) +================================ + +Bugfixes +-------- + - twisted.news.nntp.NNTPServer now has additional test coverage and + less redundant implementation code. (#5537) + +Deprecations and Removals +------------------------- + - The ability to pass a string article to NNTPServer._gotBody and + NNTPServer._gotArticle in t.news.nntp has been deprecated for years + and is now removed. (#4548) + + +Twisted News 12.0.0 (2012-02-10) +================================ + +No significant changes have been made for this release. + + +Twisted News 11.1.0 (2011-11-15) +================================ + +No significant changes have been made for this release. + + Twisted News 11.0.0 (2011-04-01) ================================ diff -Nru twisted-news-11.0.0/README twisted-news-12.1.0/README --- twisted-news-11.0.0/README 2011-04-02 01:10:15.000000000 +0000 +++ twisted-news-12.1.0/README 2012-06-02 07:04:01.000000000 +0000 @@ -1,4 +1,4 @@ -Twisted News 11.0.0 +Twisted News 12.1.0 News depends on Twisted, and, if you want to use the moderation features, Twisted Mail. diff -Nru twisted-news-11.0.0/twisted/news/nntp.py twisted-news-12.1.0/twisted/news/nntp.py --- twisted-news-11.0.0/twisted/news/nntp.py 2011-02-14 04:45:15.000000000 +0000 +++ twisted-news-12.1.0/twisted/news/nntp.py 2012-03-19 19:04:29.000000000 +0000 @@ -6,8 +6,6 @@ """ NNTP protocol support. -Maintainer: Jp Calderone - The following protocol commands are currently understood:: LIST LISTGROUP XOVER XHDR @@ -15,7 +13,7 @@ BODY NEXT MODE STREAM MODE READER SLAVE LAST QUIT HELP IHAVE XPATH XINDEX XROVER TAKETHIS CHECK - + The following protocol commands require implementation:: NEWNEWS @@ -31,12 +29,6 @@ """ import time -import types - -try: - import cStringIO as StringIO -except: - import StringIO from twisted.protocols import basic from twisted.python import log @@ -47,7 +39,7 @@ try: a = int(articles[0]) return a, a - except ValueError, e: + except ValueError: return None, None elif len(articles) == 2: try: @@ -59,7 +51,7 @@ h = int(articles[1]) else: h = None - except ValueError, e: + except ValueError: return None, None return l, h @@ -73,7 +65,7 @@ except ValueError: return None - + class NNTPError(Exception): def __init__(self, string): self.string = string @@ -87,22 +79,22 @@ def __init__(self): self.currentGroup = None - + self._state = [] self._error = [] self._inputBuffers = [] self._responseCodes = [] self._responseHandlers = [] - + self._postText = [] - + self._newState(self._statePassive, None, self._headerInitial) def gotAllGroups(self, groups): "Override for notification when fetchGroups() action is completed" - - + + def getAllGroupsFailed(self, error): "Override for notification when fetchGroups() action fails" @@ -158,31 +150,31 @@ def postedOk(self): "Override for notification when postArticle() action is successful" - + def postFailed(self, error): "Override for notification when postArticle() action fails" def gotXHeader(self, headers): "Override for notification when getXHeader() action is successful" - - + + def getXHeaderFailed(self, error): "Override for notification when getXHeader() action fails" def gotNewNews(self, news): "Override for notification when getNewNews() action is successful" - - + + def getNewNewsFailed(self, error): "Override for notification when getNewNews() action fails" def gotNewGroups(self, groups): "Override for notification when getNewGroups() action is successful" - - + + def getNewGroupsFailed(self, error): "Override for notification when getNewGroups() action fails" @@ -241,7 +233,7 @@ self.sendLine('HEAD %s' % (index,)) self._newState(self._stateHead, self.getHeadFailed) - + def fetchBody(self, index = ''): """ Get the body for the specified article (or the currently selected @@ -280,7 +272,7 @@ groups since the specified date - in seconds since the epoch, GMT - optionally restricted to the given distributions. gotNewNews() is called on success, getNewNewsFailed() on failure. - + One invocation of this function may result in multiple invocations of gotNewNews()/getNewNewsFailed(). """ @@ -290,14 +282,14 @@ while len(groups) and len(line) + len(groupPart) + len(groups[-1]) + 1 < NNTPClient.MAX_COMMAND_LENGTH: group = groups.pop() groupPart = groupPart + ',' + group - + self.sendLine(line % (groupPart,)) self._newState(self._stateNewNews, self.getNewNewsFailed) - + if len(groups): self.fetchNewNews(groups, date, distributions) - - + + def fetchNewGroups(self, date, distributions): """ Get the names of all new groups created/added to the server since @@ -340,7 +332,7 @@ Set the mode to STREAM, suspending the normal "lock-step" mode of communications. setStreamSuccess() is called on success, setStreamFailed() on failure. - """ + """ self.sendLine('MODE STREAM') self._newState(None, self.setStreamFailed, self._headerMode) @@ -376,8 +368,8 @@ def _setResponseCode(self, code): self._responseCodes[0] = code - - + + def _getResponseCode(self): return self._responseCodes[0] @@ -492,15 +484,15 @@ self._newLine(line.split(), 0) else: self._gotXHeader(self._endState()) - - + + def _stateNewNews(self, line): if line != '.': self._newLine(line, 0) else: self.gotNewNews(self._endState()) - - + + def _stateNewGroups(self, line): if line != '.': self._newLine(line, 0) @@ -676,7 +668,7 @@ else: # FIXME: articles may be a message-id l, h = parseRange(range) - + if l is h is None: self.sendLine('430 no such article') else: @@ -700,24 +692,6 @@ self.sendLine('502 no permission') - def do_XROVER(self, header, range = None): - d = self.xhdrWork(header, range) - if d: - d.addCallbacks(self._gotXROVER, self._errXROVER) - - - def _gotXROVER(self, parts): - self.sendLine('224 Overview information follows') - for i in parts: - self.sendLine('%d %s' % i) - self.sendLine('.') - - - def _errXROVER(self, failure): - print 'XROVER failed: ', - self._errXHDR(failure) - - def do_POST(self): self.inputHandler = self._doingPost self.message = '' @@ -738,8 +712,8 @@ def _gotPost(self, parts): self.sendLine('240 article posted ok') - - + + def _errPost(self, failure): print 'POST failed: ', failure self.sendLine('441 posting failed') @@ -748,15 +722,15 @@ def do_CHECK(self, id): d = self.factory.backend.articleExistsRequest(id) d.addCallbacks(self._gotCheck, self._errCheck) - - + + def _gotCheck(self, result): if result: self.sendLine("438 already have it, please don't send it to me") else: self.sendLine('238 no such article found, please send it to me') - - + + def _errCheck(self, failure): print 'CHECK failed: ', failure self.sendLine('431 try sending it again later') @@ -765,8 +739,8 @@ def do_TAKETHIS(self, id): self.inputHandler = self._doingTakeThis self.message = '' - - + + def _doingTakeThis(self, line): if line == '.': self.inputHandler = None @@ -780,8 +754,8 @@ def _didTakeThis(self, result): self.sendLine('239 article transferred ok') - - + + def _errTakeThis(self, failure): print 'TAKETHIS failed: ', failure self.sendLine('439 article transfer failed') @@ -791,13 +765,13 @@ defer = self.factory.backend.groupRequest(group) defer.addCallbacks(self._gotGroup, self._errGroup) - + def _gotGroup(self, (name, num, high, low, flags)): self.currentGroup = name self.currentIndex = low self.sendLine('211 %d %d %d %s group selected' % (num, low, high, name)) - - + + def _errGroup(self, failure): print 'GROUP failed: ', failure self.sendLine('411 no such group') @@ -818,8 +792,8 @@ else: try: article = int(article) - return func(self.currentGroup, article) - except ValueError, e: + return func(self.currentGroup, article) + except ValueError: self.sendLine('501 command syntax error') @@ -830,20 +804,13 @@ def _gotArticle(self, (index, id, article)): - if isinstance(article, types.StringType): - import warnings - warnings.warn( - "Returning the article as a string from `articleRequest' " - "is deprecated. Return a file-like object instead." - ) - article = StringIO.StringIO(article) self.currentIndex = index self.sendLine('220 %d %s article' % (index, id)) s = basic.FileSender() d = s.beginFileTransfer(article, self.transport) d.addCallback(self.finishedFileTransfer) - - ## + + ## ## Helper for FileSender ## def finishedFileTransfer(self, lastsent): @@ -863,8 +830,8 @@ defer = self.articleWork(article, 'STAT', self.factory.backend.articleRequest) if defer: defer.addCallbacks(self._gotStat, self._errStat) - - + + def _gotStat(self, (index, id, article)): self.currentIndex = index self.sendLine('223 %d %s article retreived - request text separately' % (index, id)) @@ -879,15 +846,15 @@ defer = self.articleWork(article, 'HEAD', self.factory.backend.headRequest) if defer: defer.addCallbacks(self._gotHead, self._errHead) - - + + def _gotHead(self, (index, id, head)): self.currentIndex = index self.sendLine('221 %d %s article retrieved' % (index, id)) self.transport.write(head + '\r\n') self.sendLine('.') - - + + def _errHead(self, failure): print 'HEAD failed: ', failure self.sendLine('423 no such article number in this group') @@ -900,13 +867,6 @@ def _gotBody(self, (index, id, body)): - if isinstance(body, types.StringType): - import warnings - warnings.warn( - "Returning the article as a string from `articleRequest' " - "is deprecated. Return a file-like object instead." - ) - body = StringIO.StringIO(body) self.currentIndex = index self.sendLine('221 %d %s article retrieved' % (index, id)) self.lastsent = '' @@ -949,13 +909,13 @@ self.sendLine('205 goodbye') self.transport.loseConnection() - + def do_HELP(self): self.sendLine('100 help text follows') self.sendLine('Read the RFC.') self.sendLine('.') - - + + def do_SLAVE(self): self.sendLine('202 slave status noted') self.servingeSlave = 1 @@ -974,14 +934,21 @@ self.sendLine('502 access restriction or permission denied') - def do_XROVER(self, range = None): - self.do_XHDR(self, 'References', range) + def do_XROVER(self, range=None): + """ + Handle a request for references of all messages in the currently + selected group. + + This generates the same response a I{XHDR References} request would + generate. + """ + self.do_XHDR('References', range) def do_IHAVE(self, id): self.factory.backend.articleExistsRequest(id).addCallback(self._foundArticle) - + def _foundArticle(self, result): if result: self.sendLine('437 article rejected - do not try again') @@ -989,15 +956,15 @@ self.sendLine('335 send article to be transferred. End with .') self.inputHandler = self._handleIHAVE self.message = '' - - + + def _handleIHAVE(self, line): if line == '.': self.inputHandler = None self.factory.backend.postRequest( self.message ).addCallbacks(self._gotIHAVE, self._errIHAVE) - + self.message = '' else: self.message = self.message + line + '\r\n' @@ -1005,8 +972,8 @@ def _gotIHAVE(self, result): self.sendLine('235 article transferred ok') - - + + def _errIHAVE(self, failure): print 'IHAVE failed: ', failure self.sendLine('436 transfer failed - try again later') @@ -1017,7 +984,7 @@ A client that connects to an NNTP server and asks for articles new since a certain time. """ - + def __init__(self, groups, date, storage): """ Fetch all new articles from the given groups since the diff -Nru twisted-news-11.0.0/twisted/news/tap.py twisted-news-12.1.0/twisted/news/tap.py --- twisted-news-11.0.0/twisted/news/tap.py 2011-02-14 04:45:15.000000000 +0000 +++ twisted-news-12.1.0/twisted/news/tap.py 2011-10-18 10:31:11.000000000 +0000 @@ -84,7 +84,11 @@ ["datadir", "d", "news.db", "Root data storage path"], ["mailhost", "m", "localhost", "Host of SMTP server to use"] ] - zsh_actions = {"datadir" : "_dirs", "mailhost" : "_hosts"} + compData = usage.Completions( + optActions={"datadir" : usage.CompleteDirs(), + "mailhost" : usage.CompleteHostnames(), + "interface" : usage.CompleteNetInterfaces()} + ) def __init__(self): usage.Options.__init__(self) diff -Nru twisted-news-11.0.0/twisted/news/test/test_database.py twisted-news-12.1.0/twisted/news/test/test_database.py --- twisted-news-11.0.0/twisted/news/test/test_database.py 2011-02-14 04:45:15.000000000 +0000 +++ twisted-news-12.1.0/twisted/news/test/test_database.py 2011-07-14 19:05:14.000000000 +0000 @@ -102,7 +102,7 @@ result = storage.postRequest(message) def cbPosted(ignored): - self.assertEquals(self._email, []) + self.assertEqual(self._email, []) exists = storage.articleExistsRequest(articleID) exists.addCallback(self.assertTrue) return exists @@ -126,14 +126,14 @@ result = storage.postRequest(message) def cbModerated(ignored): - self.assertEquals(len(self._email), 1) - self.assertEquals(self._email[0][0], mailhost) - self.assertEquals(self._email[0][1], sender) - self.assertEquals(self._email[0][2], [moderator]) + self.assertEqual(len(self._email), 1) + self.assertEqual(self._email[0][0], mailhost) + self.assertEqual(self._email[0][1], sender) + self.assertEqual(self._email[0][2], [moderator]) self._checkModeratorMessage( self._email[0][3], sender, moderator, group, message) - self.assertEquals(self._email[0][4], None) - self.assertEquals(self._email[0][5], 25) + self.assertEqual(self._email[0][4], None) + self.assertEqual(self._email[0][5], 25) exists = storage.articleExistsRequest(articleID) exists.addCallback(self.assertFalse) return exists @@ -146,7 +146,7 @@ msg = p.parsestr(messageText) headers = dict(msg.items()) del headers['Message-ID'] - self.assertEquals( + self.assertEqual( headers, {'From': sender, 'To': moderator, @@ -157,9 +157,9 @@ attachment = msg.get_payload()[0] for header in ['from', 'to', 'subject', 'message-id', 'newsgroups']: - self.assertEquals(posting[header], attachment[header]) + self.assertEqual(posting[header], attachment[header]) - self.assertEquals(posting.get_payload(), attachment.get_payload()) + self.assertEqual(posting.get_payload(), attachment.get_payload()) @@ -208,7 +208,7 @@ shelf = NewsShelf('example.com', self.mktemp(), 'alice@example.com') shelf.sendmail = self.sendmail shelf.notifyModerator('bob@example.org', Article('Foo: bar', 'Some text')) - self.assertEquals(len(self._email), 1) + self.assertEqual(len(self._email), 1) def test_defaultSender(self): @@ -220,5 +220,5 @@ shelf = NewsShelf('example.com', self.mktemp()) shelf.sendmail = self.sendmail shelf.notifyModerators(['bob@example.org'], Article('Foo: bar', 'Some text')) - self.assertEquals(self._email[0][1], 'twisted-news@' + gethostname()) + self.assertEqual(self._email[0][1], 'twisted-news@' + gethostname()) self.assertIn('From: twisted-news@' + gethostname(), self._email[0][3]) diff -Nru twisted-news-11.0.0/twisted/news/test/test_news.py twisted-news-12.1.0/twisted/news/test/test_news.py --- twisted-news-11.0.0/twisted/news/test/test_news.py 2011-02-14 04:45:15.000000000 +0000 +++ twisted-news-12.1.0/twisted/news/test/test_news.py 2011-07-14 19:05:14.000000000 +0000 @@ -50,10 +50,10 @@ def cbArticle(result): self.failUnless(isinstance(result, tuple), 'callback result is wrong type: ' + str(result)) - self.assertEquals(len(result), 3, + self.assertEqual(len(result), 3, 'callback result list should have three entries: ' + str(result)) - self.assertEquals(result[1], MESSAGE_ID, + self.assertEqual(result[1], MESSAGE_ID, "callback result Message-Id doesn't match: %s vs %s" % (MESSAGE_ID, result[1])) body = result[2].read() @@ -76,11 +76,11 @@ return d def cbHead(result): - self.assertEquals(result[1], MESSAGE_ID, + self.assertEqual(result[1], MESSAGE_ID, "callback result Message-Id doesn't match: %s vs %s" % (MESSAGE_ID, result[1])) - self.assertEquals(result[2][-2:], '\r\n', + self.assertEqual(result[2][-2:], '\r\n', "headers must be \\r\\n terminated.") d.addCallback(cbArticle) @@ -99,7 +99,7 @@ def cbBody(result): body = result[2].read() - self.assertEquals(body[0:4], 'this', + self.assertEqual(body[0:4], 'this', "message body has been altered: " + pformat(body[0:4])) diff -Nru twisted-news-11.0.0/twisted/news/test/test_nntp.py twisted-news-12.1.0/twisted/news/test/test_nntp.py --- twisted-news-11.0.0/twisted/news/test/test_nntp.py 2011-02-14 04:45:15.000000000 +0000 +++ twisted-news-12.1.0/twisted/news/test/test_nntp.py 2012-03-19 19:04:29.000000000 +0000 @@ -5,6 +5,7 @@ from twisted.news import database from twisted.news import nntp from twisted.protocols import loopback +from twisted.test import proto_helpers ALL_GROUPS = ('alt.test.nntp', 0, 1, 'y'), GROUP = ('0', '1', '0', 'alt.test.nntp', 'group', 'selected') @@ -36,39 +37,39 @@ def __init__(self): nntp.NNTPClient.__init__(self) - def assertEquals(self, foo, bar): + def assertEqual(self, foo, bar): if foo != bar: raise AssertionError("%r != %r!" % (foo, bar)) - + def connectionMade(self): nntp.NNTPClient.connectionMade(self) self.fetchSubscriptions() def gotSubscriptions(self, subscriptions): - self.assertEquals(len(subscriptions), len(SUBSCRIPTIONS)) + self.assertEqual(len(subscriptions), len(SUBSCRIPTIONS)) for s in subscriptions: assert s in SUBSCRIPTIONS self.fetchGroups() - + def gotAllGroups(self, info): - self.assertEquals(len(info), len(ALL_GROUPS)) - self.assertEquals(info[0], ALL_GROUPS[0]) - + self.assertEqual(len(info), len(ALL_GROUPS)) + self.assertEqual(info[0], ALL_GROUPS[0]) + self.fetchGroup('alt.test.nntp') - - + + def getAllGroupsFailed(self, error): raise AssertionError("fetchGroups() failed: %s" % (error,)) def gotGroup(self, info): - self.assertEquals(len(info), 6) - self.assertEquals(info, GROUP) - + self.assertEqual(len(info), 6) + self.assertEqual(info, GROUP) + self.postArticle(POST_STRING) - - + + def getSubscriptionsFailed(self, error): raise AssertionError("fetchSubscriptions() failed: %s" % (error,)) @@ -84,17 +85,17 @@ def postedOk(self): self.fetchArticle(1) - + def gotArticle(self, info): origBody = POST_STRING.split('\n\n')[1] newBody = info.split('\n\n', 1)[1] - self.assertEquals(origBody, newBody) - + self.assertEqual(origBody, newBody) + # We're done self.transport.loseConnection() - - + + def getArticleFailed(self, error): raise AssertionError("fetchArticle() failed: %s" % (error,)) @@ -105,10 +106,12 @@ self.server.factory = self self.backend = database.NewsShelf(None, 'news.db') self.backend.addGroup('alt.test.nntp', 'y') - + for s in SUBSCRIPTIONS: self.backend.addSubscription(s) + self.transport = proto_helpers.StringTransport() + self.server.makeConnection(self.transport) self.client = TestNNTPClient() def testLoopback(self): @@ -122,3 +125,73 @@ # reactor.iterate(1) # fetchGroup() # reactor.iterate(1) # postArticle() + + def test_connectionMade(self): + """ + When L{NNTPServer} is connected, it sends a server greeting to the + client. + """ + self.assertEqual( + self.transport.value().split('\r\n'), [ + '200 server ready - posting allowed', + '']) + + + def test_LIST(self): + """ + When L{NTTPServer} receives a I{LIST} command, it sends a list of news + groups to the client (RFC 3977, section 7.6.1.1). + """ + self.transport.clear() + self.server.do_LIST() + self.assertEqual( + self.transport.value().split('\r\n'), [ + '215 newsgroups in form "group high low flags"', + 'alt.test.nntp 0 1 y', + '.', + '']) + + + def test_GROUP(self): + """ + When L{NNTPServer} receives a I{GROUP} command, it sends a line of + information about that group to the client (RFC 3977, section 6.1.1.1). + """ + self.transport.clear() + self.server.do_GROUP('alt.test.nntp') + self.assertEqual( + self.transport.value().split('\r\n'), [ + '211 0 1 0 alt.test.nntp group selected', + '']) + + + def test_LISTGROUP(self): + """ + When L{NNTPServer} receives a I{LISTGROUP} command, it sends a list of + message numbers for the messages in a particular group (RFC 3977, + section 6.1.2.1). + """ + self.transport.clear() + self.server.do_LISTGROUP('alt.test.nntp') + self.assertEqual( + self.transport.value().split('\r\n'), [ + '211 list of article numbers follow', + '.', + '']) + + + def test_XROVER(self): + """ + When L{NTTPServer} receives a I{XROVER} command, it sends a list of + I{References} header values for the messages in a particular group (RFC + 2980, section 2.11). + """ + self.server.do_GROUP('alt.test.nntp') + self.transport.clear() + + self.server.do_XROVER() + self.assertEqual( + self.transport.value().split('\r\n'), [ + '221 Header follows', + '.', + '']) diff -Nru twisted-news-11.0.0/twisted/news/_version.py twisted-news-12.1.0/twisted/news/_version.py --- twisted-news-11.0.0/twisted/news/_version.py 2011-04-02 01:10:15.000000000 +0000 +++ twisted-news-12.1.0/twisted/news/_version.py 2012-06-02 07:04:01.000000000 +0000 @@ -1,3 +1,3 @@ # This is an auto-generated file. Do not edit it. from twisted.python import versions -version = versions.Version('twisted.news', 11, 0, 0) +version = versions.Version('twisted.news', 12, 1, 0)