def test_copy_template(self):
     tester1 = Database_manage_recap()
     username = '******'
     tester1.dbconnection(username)
     answer = tester1.copy_template()
     #print('ans: ', type(answer))
     self.assertEqual(type(answer), dict," the method should return a dictionary")
 def test_dbconnection(self):
     tester1 = Database_manage_recap()
     username = '******'
     answer = str(tester1.dbconnection(username))
     #print('ans: ', type(answer))
     self.assertEqual(answer,
      "Collection(Database(MongoClient('localhost', 27017), 'recap'), 'testercompany')",
      "It should read dCollection(Database(MongoClient('localhost', 27017),'recap'), 'testercompany')")
 def test_create_interface_dict(self):
     page = 'sales'
     customer_name = 'testercompany'
     tester1 = Database_manage_recap()
     tester1.dbconnection(customer_name)
     #tester1.copy_template()
     answer = tester1.create_interface_dict(page, customer_name)
     print('ans: ', type(answer))
     print('ans: ', (answer))
Exemple #4
0
 def set_pricing(self, username):
     pass
     username = username + '_pricing'
     print('username : '******'set_pricing')
     tester1 = Database_manage_recap()
     self.store = tester1.dbconnection(username, 'pricing_master_template')
     temp = tester1.copy_template()
     #print(temp)
     return temp
def professional_services():
    username = login_check()
    if (username is None):
        redirect()
    #print('-------******************************-------')
    database = Database_manage_recap()
    database.dbconnection(username)
    section_interface_dict, question_interface_dict = database.create_interface_dict('prof', username)
    return bottle.template('tab', form1=section_interface_dict,
                 form2=question_interface_dict,
                 username=username)
def scoping():
    username = login_check()
    if (username is None):
        redirect()
    #print('-------******************************-------')
    database = Database_manage_recap()
    database.dbconnection(username)
    section_interface_dict, question_interface_dict = database.create_interface_dict('scoping', username)
    #question_interface_dict = database.phase1()
    #print(section_interface_dict)
    #print(question_interface_dict)
    #print('-------******************************-------')
    return bottle.template('tab', form1=section_interface_dict,
                 form2=question_interface_dict, username=username)
def form_end():
    #print('-------******************************-------')
    print('form_end')
    username = login_check()
    if (username is None):
        redirect()
    #print('-------******************************-------')
    database = Database_manage_recap()
    database.dbconnection(username)
    #username = bottle.request.forms.get("username")
    print(username)
    # form = bottle.request.forms.get('answer')
    section_no = bottle.request.forms.get('section')
    free_text = bottle.request.forms.get('free_text')
    #print ('free_text here', free_text, username)
    #print('section = ', section_no)
    section_no = int(section_no)
    save_free_text(section_no, free_text, username)
    no_questions = database.count_questions(section_no)
    #print('no questions',no_questions)

    if section_no < 13:
        modifier = 'sales'
    elif section_no > 45:
        modifier = 'prof'
    else:
        modifier = 'scoping'

    form = {}
    for x in range(no_questions):
        x = (section_no * 1000) + (x + 1)
        #print(x)
        x = str(x)
        #print('x',x)
        form[x] = bottle.request.forms.get(x)
        #print(x,form[x])

    section_interface_dict, question_interface_dict = save_answer(form,  modifier, username)

    return bottle.template("tab",
             form1=section_interface_dict, form2=question_interface_dict, username=username)
def user_interface():
    username = login_check()
    if (username is None):
        redirect()
    #print('-------******************************-------')
    database = Database_manage_recap()
    database.dbconnection(username)
    #username = bottle.request.forms.get("username")
    #print(username)
    section_interface_dict, question_interface_dict = database.create_interface_dict('sales', username)
    #username = bottle.request.forms.get("username")
    #cook = bottle.request.get_cookie('session')
    #print('cook-interface',cook)
    #question_interface_dict = database.phase1()
    #print(section_interface_dict)
    #print(question_interface_dict)
    #print('-------******************************-------')

    return bottle.template('tab', form1=section_interface_dict,
                 form2=question_interface_dict,
                 username=username)
"""
    interface with the mongo database to allow changes
"""


import bottle
from database_manage import Database_manage_recap
import ast

# connect to mongoDB
connection_string = "mongodb://localhost"
database = Database_manage_recap()
database.connection()


@bottle.post('/')
@bottle.route('/')
def menu():
    print('menu')
    # reloads each time( dsorry testing purposes
    cursor = database.copy_template()
    return bottle.template('menu')


@bottle.post('/create_tag_names')
@bottle.route('/create_tag_names')
def create_tag_names():
    print('create_tag_names')

    tag_array = database.get_list_tag_names()
    print('tag_array', tag_array)
Exemple #10
0
 def test_check_create_db(self):
     customer_name = 'testercompany'
     tester1 = Database_manage_recap()
     answer = tester1.check_create_db(customer_name)
     #print('ans',answer)
     self.assertEqual(answer, customer_name," the method should return a dictionary")