<s> from tests import TestCase <EOL> from . mocks import MockForm <EOL> from flask_generic_views import CreateFormView , ShowView <EOL> class TestCreateFormView ( TestCase ) : <EOL> def setup_method ( self , method ) : <EOL> TestCase . setup_method ( self , method ) <EOL> self . app . add_url_rule ( '<STR_LIT>' , <EOL> view_func = CreateFormView . as_view ( '<STR_LIT>' , <EOL> model_class = self . User , <EOL> form_class = MockForm <EOL> ) <EOL> ) <EOL> self . app . add_url_rule ( '<STR_LIT>' , <EOL> view_func = ShowView . as_view ( '<STR_LIT>' , model_class = self . User ) <EOL> ) <EOL> def test_renders_template_on_get_request ( self ) : <EOL> response = self . client . get ( '<STR_LIT>' ) <EOL> assert response . status_code == <NUM_LIT:200> <EOL> def test_redirects_on_succesful_post_request ( self ) : <EOL> response = self . client . post ( '<STR_LIT>' , <EOL> data = { '<STR_LIT:name>' : u'<STR_LIT>' } <EOL> ) <EOL> assert response . status_code == <NUM_LIT> <EOL> def test_updates_database_on_succesful_post_request ( self ) : <EOL> self . client . post ( '<STR_LIT>' , <EOL> data = { '<STR_LIT:name>' : u'<STR_LIT>' } <EOL> ) <EOL> assert self . User . query . first ( ) . name == u'<STR_LIT>' </s>
