<s> from __future__ import absolute_import , unicode_literals <EOL> from django . core . urlresolvers import reverse <EOL> from django . test import TestCase <EOL> from django_nyt import models , utils <EOL> try : <EOL> from django . contrib . auth import get_user_model <EOL> User = get_user_model ( ) <EOL> except ImportError : <EOL> from django . contrib . auth . models import User <EOL> class TestViews ( TestCase ) : <EOL> def setUp ( self ) : <EOL> super ( TestViews , self ) . setUp ( ) <EOL> self . TEST_KEY = '<STR_LIT>' <EOL> self . user = User . objects . create_user ( <EOL> '<STR_LIT>' , <EOL> password = '<STR_LIT:password>' , <EOL> ) <EOL> self . user_settings = models . Settings . get_default_setting ( self . user ) <EOL> def test_mark_read ( self ) : <EOL> utils . subscribe ( self . user_settings , self . TEST_KEY ) <EOL> utils . notify ( "<STR_LIT>" , self . TEST_KEY ) <EOL> self . assertEqual ( models . Notification . objects . filter ( is_viewed = False ) . count ( ) , <EOL> <NUM_LIT:1> ) <EOL> nid = models . Notification . objects . get ( ) . id <EOL> self . client . login ( username = self . user . username , <EOL> password = '<STR_LIT:password>' ) <EOL> self . client . get ( reverse ( '<STR_LIT>' , args = ( nid , ) ) ) <EOL> self . assertEqual ( models . Notification . objects . filter ( is_viewed = False ) . count ( ) , <EOL> <NUM_LIT:0> ) </s>
