#NEWLINE# @ attr ( user = 'blogger' ) #NEWLINE# def test_new_post( self ) : #NEWLINE# #INDENT# posts = self . blog . post_assets #NEWLINE# newpost = typepad . Post ( title = 'Hi a test post' , content = 'This is my test post. Is it not nifty?' , filename = 'asfdasf' , categories = [ 'Weblogs' ] ) #NEWLINE# self . assert_ ( ( newpost . url_id is None ) ) #NEWLINE# posts . post ( newpost ) #NEWLINE# try : #NEWLINE# #INDENT# self . assert_ ( ( newpost . url_id is not None ) ) #NEWLINE# self . assert_ ( newpost . permalink_url ) #NEWLINE# self . assert_ ( ( 'asfdasf' in newpost . permalink_url ) ) #NEWLINE# self . assert_ ( isinstance ( newpost . published , datetime ) ) #NEWLINE# self . assertEquals ( newpost . text_format , 'html' ) #NEWLINE# self . assert_ ( ( newpost . rendered_content is not None ) ) #NEWLINE# self . assertEquals ( newpost . author . url_id , self . blogger . url_id ) #NEWLINE# self . assertEquals ( newpost . container . object_type , 'Blog' ) #NEWLINE# self . assert_ ( ( not newpost . publication_status . draft ) ) #NEWLINE# has_newpost = ( lambda x : self . assert_ ( [ post for post in x if ( post . url_id == newpost . url_id ) ] ) ) #NEWLINE# has_newpost ( self . blog . post_assets . filter ( recent = True ) ) #NEWLINE# has_newpost ( self . blog . post_assets . filter ( published = True , recent = True ) ) #NEWLINE# self . assertRaises ( self . blog . post_assets . RequestError , ( lambda : self . blog . post_assets . filter ( by_category = 'Weblogs' ) . deliver ( ) ) ) #NEWLINE# yearmonth = newpost . published . strftime ( '%Y-%m' ) #NEWLINE# self . assertRaises ( self . blog . post_assets . RequestError , ( lambda : self . blog . post_assets . filter ( by_month = yearmonth ) . deliver ( ) ) ) #NEWLINE# #UNINDENT# finally : #NEWLINE# #INDENT# newpost . delete ( )