# Path: tests/python/util.py
# def setUpModule():
#     """Create the tables in the doko_test schema."""
#     engine.execute(DDL('DROP SCHEMA IF EXISTS doko_test CASCADE'))
#     try:
#         Base.metadata.create_all(engine)
#     except Exception:
#         engine.execute(DDL('DROP SCHEMA IF EXISTS doko_test CASCADE'))
#         raise
# 
# def tearDownModule():
#     """Drop the doko_test schema."""
#     engine.execute(DDL('DROP SCHEMA IF EXISTS doko_test CASCADE'))


import base64
import datetime
import functools
import json
import os
import re
import signal
import sys
import time
import unittest
import urllib.error
import dateutil.parser
import pytz
import tests.python.util
import config
from decimal import Decimal
from distutils.version import StrictVersion
from http.client import HTTPConnection
from urllib.request import urlopen
from bs4 import BeautifulSoup
from dateutil.tz import tzoffset
from passlib.hash import bcrypt_sha256
from selenium import webdriver
from selenium.common.exceptions import (
    TimeoutException, ElementNotVisibleException, WebDriverException
)
from selenium.webdriver import ActionChains
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.select import Select
from tests.python.util import setUpModule, tearDownModule
from dokomoforms.models import (
    Survey, Submission, Photo, Administrator, Node, Choice, SubSurvey,
    construct_survey, construct_survey_node, construct_node, construct_bucket
)
        self.click(self.drv.find_element_by_class_name('navigate-right'))
        self.click(self.drv.find_elements_by_tag_name('button')[0])

        new_submission = self.get_last_submission(survey_id)

        self.assertEqual(new_submission.answers[0].answer, 3)
        self.assertEqual(new_submission.answers[1].answer, 4)

    @report_success_status
    def test_basic_branching(self):
        user = (
            self.session
            .query(Administrator)
            .get('b7becd02-1a3f-4c1d-a0e1-286ba121aef4')
        )
        with self.session.begin():
            survey = construct_survey(
                creator=user,
                survey_type='public',
                title={'English': 'basic branching'},
                nodes=[
                    construct_survey_node(
                        node=construct_node(
                            title={'English': 'integer_0'},
                            type_constraint='integer',
                        ),
                    ),
                    construct_survey_node(
                        node=construct_node(
                            title={'English': 'integer_1'},

# Path: tests/python/util.py
# def setUpModule():
#     """Create the tables in the doko_test schema."""
#     engine.execute(DDL('DROP SCHEMA IF EXISTS doko_test CASCADE'))
#     try:
#         Base.metadata.create_all(engine)
#     except Exception:
#         engine.execute(DDL('DROP SCHEMA IF EXISTS doko_test CASCADE'))
#         raise
# 
# def tearDownModule():
#     """Drop the doko_test schema."""
#     engine.execute(DDL('DROP SCHEMA IF EXISTS doko_test CASCADE'))


# Path: tests/python/test_selenium.py
import base64
import datetime
import functools
import json
import os
import re
import signal
import sys
import time
import unittest
import urllib.error
import dateutil.parser
import pytz
import tests.python.util
import config
from decimal import Decimal
from distutils.version import StrictVersion
from http.client import HTTPConnection
from urllib.request import urlopen
from bs4 import BeautifulSoup
from dateutil.tz import tzoffset
from passlib.hash import bcrypt_sha256
from selenium import webdriver
from selenium.common.exceptions import (
    TimeoutException, ElementNotVisibleException, WebDriverException
)
from selenium.webdriver import ActionChains
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.select import Select
from tests.python.util import setUpModule, tearDownModule
from dokomoforms.models import (
    Survey, Submission, Photo, Administrator, Node, Choice, SubSurvey,
    construct_survey, construct_survey_node, construct_node, construct_bucket
)

        self.click(self.drv.find_element_by_class_name('navigate-right'))
        self.click(self.drv.find_elements_by_tag_name('button')[0])

        new_submission = self.get_last_submission(survey_id)

        self.assertEqual(new_submission.answers[0].answer, 3)
        self.assertEqual(new_submission.answers[1].answer, 4)

    @report_success_status
    def test_basic_branching(self):
        user = (
            self.session
            .query(Administrator)
            .get('b7becd02-1a3f-4c1d-a0e1-286ba121aef4')
        )
        with self.session.begin():
            survey = construct_survey(
                creator=user,
                survey_type='public',
                title={'English': 'basic branching'},
                nodes=[
                    construct_survey_node(
                        node=construct_node(
                            title={'English': 'integer_0'},
                            type_constraint='integer',
                        ),
                    ),
                    construct_survey_node(
                        node=construct_node(
                            title={'English': 'integer_1'},

                            type_constraint='integer',