<s> from __future__ import unicode_literals <EOL> import frappe <EOL> import unittest <EOL> from frappe . website . render import build_page <EOL> from frappe . website . doctype . web_form . web_form import accept <EOL> test_records = frappe . get_test_records ( '<STR_LIT>' ) <EOL> class TestWebForm ( unittest . TestCase ) : <EOL> def setUp ( self ) : <EOL> frappe . conf . disable_website_cache = True <EOL> frappe . local . path = None <EOL> def tearDown ( self ) : <EOL> frappe . conf . disable_website_cache = False <EOL> frappe . local . path = None <EOL> def test_basic ( self ) : <EOL> frappe . set_user ( "<STR_LIT>" ) <EOL> html = build_page ( "<STR_LIT>" ) <EOL> self . assertTrue ( "<STR_LIT>" in html ) <EOL> def test_logged_in ( self ) : <EOL> frappe . set_user ( "<STR_LIT>" ) <EOL> html = build_page ( "<STR_LIT>" ) <EOL> self . assertFalse ( "<STR_LIT>" in html ) <EOL> self . assertTrue ( '<STR_LIT>' in html ) <EOL> def test_new ( self ) : <EOL> frappe . set_user ( "<STR_LIT>" ) <EOL> frappe . local . form_dict . new = <NUM_LIT:1> <EOL> html = build_page ( "<STR_LIT>" ) <EOL> self . assertTrue ( '<STR_LIT>' in html ) <EOL> def test_accept ( self ) : <EOL> frappe . set_user ( "<STR_LIT>" ) <EOL> frappe . form_dict . web_form = "<STR_LIT>" <EOL> frappe . form_dict . doctype = "<STR_LIT>" <EOL> frappe . form_dict . subject = "<STR_LIT>" <EOL> frappe . form_dict . description = "<STR_LIT>" <EOL> frappe . form_dict . starts_on = "<STR_LIT>" <EOL> accept ( ) <EOL> self . event_name = frappe . db . get_value ( "<STR_LIT>" , <EOL> { "<STR_LIT>" : "<STR_LIT>" } ) <EOL> self . assertTrue ( self . event_name ) <EOL> def test_edit ( self ) : <EOL> self . test_accept ( ) <EOL> frappe . form_dict . web_form = "<STR_LIT>" <EOL> frappe . form_dict . doctype = "<STR_LIT>" <EOL> frappe . form_dict . name = self . event_name <EOL> frappe . form_dict . subject = "<STR_LIT>" <EOL> frappe . form_dict . description = "<STR_LIT>" <EOL> frappe . form_dict . starts_on = "<STR_LIT>" <EOL> self . assertNotEquals ( frappe . db . get_value ( "<STR_LIT>" , <EOL> self . event_name , "<STR_LIT:description>" ) , frappe . form_dict . description ) <EOL> accept ( ) <EOL> self . assertEquals ( frappe . db . get_value ( "<STR_LIT>" , <EOL> self . event_name , "<STR_LIT:description>" ) , frappe . form_dict . description ) </s>
