Esempio n. 1
0
def create_questionnaire(client):
    questionnaire_name = "Questionnaire" + random_number(3)
    questionnaire_code = random_number(3)
    questionnaire_data = {
        'is_open_survey': ['true'],
        'profile_form': ['{"name":"' + questionnaire_name + '"}'],
        u'questionnaire-code': [str(questionnaire_code)],
        u'question-set': [
            u'['
            u'{"options":{"name":"",'
            u'"code":"code",'
            u'"required":true,'
            u'"language":"en",'
            u'"choices":[],'
            u'"length_limiter":'
            u'"length_unlimited","length":{"min":1,"max":""},'
            u'"range":{"min":"","max":""},'
            u'"label":"",'
            u'"date_format":"mm.yyyy",'
            u'"instruction":"Answer must be a text",'
            u'"newly_added_question":false,'
            u'"event_time_field_flag":false,"unique_id_type":null},'
            u'"newly_added_question":true,"range_min":"",'
            u'"event_time_field_flag":false,'
            u'"range_max":"",'
            u'"min_length":1,'
            u'"max_length":"",'
            u'"name":"",'
            u'"title":"Q1",'
            u'"code":"code",'
            u'"type":"text",'
            u'"isEntityQuestion":false,'
            u'"uniqueIdType":null,'
            u'"showDateFormats":false,'
            u'"showAddRange":false,'
            u'"showAddTextLength":true,'
            u'"required":true,'
            u'"answerType":"text",'
            u'"display":"Q1",'
            u'"choices":[{"value":{"text":"default","val":"a"},"valid":true,"error":""}],'
            u'"choiceCanBeDeleted":false,"showUniqueId":false,"date_format":"mm.yyyy","length_limiter":"length_unlimited",'
            u'"showLengthLimiter":false,'
            u'"instruction":"Answer must be a word",'
            u'"isAChoiceTypeQuestion":"none"}]'
        ]
    }

    response_created_questionnaire = client.post(
        path='/project/wizard/create/', data=questionnaire_data)

    response_dict = json.loads(response_created_questionnaire.content)
    project_id = response_dict['project_id']

    return project_id
Esempio n. 2
0
 def _get_data_sender_data(self, with_email=False, with_project_id=False):
     short_code = "rep" + random_number(3)
     email = "email" + random_number(3) + "@mailinator.com"
     return {
         "geo_code": "",
         "name": "",
         "telephone_number": random_number(6).__str__(),
         "location": "",
         "project_id": self.project_id if with_project_id else "",
         "short_code": short_code,
         "email": email if with_email else ""
     }
Esempio n. 3
0
 def create_group_with_a_contact(self):
     all_contacts_page = self.global_navigation.navigate_to_all_data_sender_page()
     unique_id = "pollcontc" + random_number(2)
     add_datasender_page = all_contacts_page.navigate_to_add_a_data_sender_page()
     add_datasender_page.create_contact(unique_id)
     add_group_page = all_contacts_page.go_to_add_group_page()
     group_name = "group" + random_number(3)
     add_group_page.enter_group_name(group_name)
     add_group_page.click_on_add_group_button()
     all_contacts_page.add_contact_to_group(unique_id, group_name)
     create_questionnaire_options_page = self.global_navigation.navigate_to_dashboard_page().navigate_to_create_project_page()
     self.create_Questionnaire_page = create_questionnaire_options_page.select_poll_questionnaire_option()
     return group_name, unique_id
Esempio n. 4
0
    def test_should_make_entry_in_postgres_when_ds_edited_with_email(self):
        data_sender_data = self._get_data_sender_data()
        short_code = data_sender_data['short_code']
        email = "email" + random_number(3) + "@mailinator.com"

        response = self.client.post(path='/entity/datasender/register/',
                                    data=data_sender_data)
        self.assertTrue('Your Contact has been successfully added. ID is: ' +
                        short_code in response.content)

        associate_data = {'project_id': [self.project_id], 'ids': [short_code]}

        response = self.client.post(path='/entity/associate/',
                                    data=associate_data)
        response_dict = json.loads(response.content)
        self.assertEqual(
            response_dict['message'],
            'Your Contact(s) have been added successfully. Contacts with an Email address added to a Questionnaire for the first time will receive an activation email with instructions.'
        )
        self.assertTrue(response_dict['success'])

        data_sender_data['email'] = email
        response = self.client.post(path='/entity/datasender/edit/' +
                                    short_code + "/",
                                    data=data_sender_data)

        self.assertTrue('Your changes have been saved.' in response.content)

        self._verify_email_is_present_in_postgres(email)
Esempio n. 5
0
    def test_should_make_entry_in_postgres_when_ds_is_given_web_access(self):
        email = "email" + random_number(3) + "@mailinator.com"
        data_sender_data = self._get_data_sender_data()
        short_code = data_sender_data['short_code']
        response = self.client.post(path='/entity/datasender/register/',
                                    data=data_sender_data)
        self.assertTrue('Your Contact has been successfully added. ID is: ' +
                        short_code in response.content)

        associate_data = {'project_id': [self.project_id], 'ids': [short_code]}

        response = self.client.post(path='/entity/associate/',
                                    data=associate_data)
        response_dict = json.loads(response.content)
        self.assertEqual(
            response_dict['message'],
            'Your Contact(s) have been added successfully. Contacts with an Email address added to a Questionnaire for the first time will receive an activation email with instructions.'
        )
        self.assertTrue(response_dict['success'])

        web_access_data = {
            'post_data':
            ['[{"email":"' + email + '","reporter_id":"' + short_code + '"}]']
        }
        response = self.client.post(path='/entity/webuser/create',
                                    data=web_access_data)
        response_dict = json.loads(response.content)
        self.assertEquals(response_dict['message'], 'Users has been created')
        self.assertTrue(response_dict['success'])

        self._verify_email_is_present_in_postgres(email)
Esempio n. 6
0
def get_existing_username_user():
    return {
        TITLE: "DT",
        NAME: "Existing Username",
        USERNAME: "******",
        MOBILE_PHONE: random_number(9)
    }
Esempio n. 7
0
 def setUpClass(cls):
     HeadlessRunnerTest.setUpClass()
     login(cls.driver)
     cls.global_navigation = GlobalNavigationPage(cls.driver)
     cls.all_contacts_page = cls.global_navigation.navigate_to_all_data_sender_page(
     )
     cls.unique_id = "rep" + random_number(3)
Esempio n. 8
0
 def _verify_renaming_group(self, group_name):
     self.all_contacts_page.select_group_rename_icon(group_name)
     new_group_name = "group_" + random_number(3)
     self.add_group_page.enter_new_group_name(new_group_name)
     self.add_group_page.click_on_rename_group()
     self.assertEquals(self.all_contacts_page.get_success_message(), "Your changes have been saved.")
     return new_group_name
Esempio n. 9
0
    def test_should_edit_a_project_manager_as_ngo_admin(self):
        self.create_user_and_open_it_on_edit_page(False, [2, 4])
        self.assertTrue(
            self.edit_user_page.is_user_name_is_prefetched(self.username))
        self.assertTrue(self.edit_user_page.is_role_project_manager())
        self.assertTrue(
            self.edit_user_page.are_questionnaires_preselected(
                self.user_questionnaire_list, True))
        selected_questionnaires = self.edit_user_page.select_questionnaires(3)
        self.edit_user_page.save_changes({
            "mobile_phone": random_number(9),
            "full_name": 'New User Name'
        })
        success_message = self.edit_user_page.get_success_message()
        self.assertEqual(
            USER_EDITED_SUCCESS_MESSAGE, success_message,
            'Expected "User has been updated successfully" message but was not found'
        )

        self.driver.go_to(ALL_USERS_URL)
        self.assertEqual('New User Name',
                         self.all_users_page.get_full_name_for(self.username))
        self.assertEqual(
            3, len(selected_questionnaires),
            'Expected the questionnaires length to be 3 but was %s' %
            len(selected_questionnaires))
Esempio n. 10
0
def generate_user():
    return {
        TITLE: "Developer",
        NAME: "Mino Rakoto",
        USERNAME: random_string(7)+"@mailinator.com",
        MOBILE_PHONE: random_number(9)
    }
Esempio n. 11
0
 def create_group_with_one_contact(self, line_number=""):
     all_contacts_page = self.global_navigation.navigate_to_all_data_sender_page()
     unique_id = "pc" + random_number(2)+"o"+line_number
     add_datasender_page = all_contacts_page.navigate_to_add_a_data_sender_page()
     add_datasender_page.create_contact(unique_id)
     add_group_page = all_contacts_page.go_to_add_group_page()
     group_name = "group" + random_number(3)
     add_group_page.enter_group_name(group_name)
     add_group_page.click_on_add_group_button()
     all_contacts_page.add_contact_to_group(unique_id, group_name)
     sleep(2)
     self.driver.wait_for_element(UI_TEST_TIMEOUT, DASHBOARD_PAGE_LINK, True)
     create_questionnaire_options_page = self.global_navigation.navigate_to_dashboard_page().navigate_to_create_project_page()
     self.assertEqual(self.driver.get_title(), "Create Questionnaire")
     self.create_questionnaire_page = create_questionnaire_options_page.select_poll_questionnaire_option()
     self.create_questionnaire_page.set_poll_questionnaire_title("poll_questionnaire", generate_random=True)
     return group_name, unique_id
Esempio n. 12
0
 def _verify_adding_a_group(self):
     self.add_group_page = self.all_contacts_page.go_to_add_group_page()
     group_name = "group_" + random_number(3)
     self.add_group_page.enter_group_name(group_name)
     self.add_group_page.click_on_add_group_button()
     self.assertEquals(self.all_contacts_page.get_success_message(),
                       "Group %s successfully added." % group_name)
     return group_name
Esempio n. 13
0
 def create_group_with_a_contact(self):
     all_contacts_page = self.global_navigation.navigate_to_all_data_sender_page(
     )
     unique_id = "pollcontc" + random_number(2)
     add_datasender_page = all_contacts_page.navigate_to_add_a_data_sender_page(
     )
     add_datasender_page.create_contact(unique_id)
     add_group_page = all_contacts_page.go_to_add_group_page()
     group_name = "group" + random_number(3)
     add_group_page.enter_group_name(group_name)
     add_group_page.click_on_add_group_button()
     all_contacts_page.add_contact_to_group(unique_id, group_name)
     self.driver.wait_for_element(UI_TEST_TIMEOUT, DASHBOARD_PAGE_LINK,
                                  True)
     dashboard_page = self.global_navigation.navigate_to_dashboard_page()
     create_questionnaire_options_page = dashboard_page.navigate_to_create_project_page(
     )
     self.create_Questionnaire_page = create_questionnaire_options_page.select_poll_questionnaire_option(
     )
     return group_name, unique_id
Esempio n. 14
0
 def test_should_edit_an_extended_user_as_ngo_admin(self):
     self.create_user_and_open_it_on_edit_page()
     self.assertTrue(
         self.edit_user_page.is_user_name_is_prefetched(self.username))
     self.assertTrue(self.edit_user_page.is_role_administrator())
     self.edit_user_page.save_changes({"mobile_phone": random_number(9)})
     success_message = self.edit_user_page.get_success_message()
     time.sleep(1)
     self.assertEqual(
         USER_EDITED_SUCCESS_MESSAGE, success_message,
         'Expected "User has been updated successfully" message but was not found'
     )
Esempio n. 15
0
    def test_should_make_entry_in_postgres_when_ds_edited_with_email(self):
        data_sender_data = self._get_data_sender_data(with_project_id=True)
        short_code = data_sender_data['short_code']
        email = "email" + random_number(3) + "@mailinator.com"
        response = self.client.post(path='/entity/datasender/register/',
                                    data=data_sender_data)
        self.assertTrue('Registration successful. ID is: ' +
                        short_code in response.content)

        data_sender_data['email'] = email
        response = self.client.post(path='/entity/datasender/edit/' +
                                    short_code + "/",
                                    data=data_sender_data)

        self.assertTrue('Your changes have been saved.' in response.content)

        self._verify_email_is_present_in_postgres(email)
Esempio n. 16
0
    def test_should_not_make_entry_in_postgres_when_contact_is_given_web_access(
            self):
        email = "email" + random_number(3) + "@mailinator.com"
        data_sender_data = self._get_data_sender_data()
        short_code = data_sender_data['short_code']
        response = self.client.post(path='/entity/datasender/register/',
                                    data=data_sender_data)
        self.assertTrue('Your Contact has been successfully added. ID is: ' +
                        short_code in response.content)
        web_access_data = {
            'post_data':
            ['[{"email":"' + email + '","reporter_id":"' + short_code + '"}]']
        }
        response = self.client.post(path='/entity/webuser/create',
                                    data=web_access_data)
        response_dict = json.loads(response.content)
        self.assertEquals(response_dict['message'], 'Users has been created')
        self.assertTrue(response_dict['success'])

        self._verify_email_is_not_present_in_postgres(email)
Esempio n. 17
0
    def test_should_edit_a_project_manager_as_extended_user(self):
        user = {
            TITLE: "Developer",
            NAME: random_string(7),
            USERNAME: random_string(7) + "@mailinator.com",
            MOBILE_PHONE: random_number(9)
        }
        new_user = {
            TITLE: "Developer",
            NAME: random_string(7),
            USERNAME: random_string(7) + "@mailinator.com",
            MOBILE_PHONE: random_number(9)
        }

        # create extended user
        self._create_extended_user(user)
        username = fetch_(USERNAME, user)
        password = DEFAULT_PASSWORD
        extended_user_credentials = {USERNAME: username, PASSWORD: password}
        self.global_navigation.sign_out()

        # Login with extended user and create project manager
        login(self.driver, extended_user_credentials)
        self.driver.wait_for_page_with_title(UI_TEST_TIMEOUT, "Dashboard")
        self.assertEqual("Dashboard", self.driver.get_title())
        self.driver.go_to(ALL_USERS_URL)

        self.all_users_page = AllUsersPage(self.driver)
        self.assertEqual(
            0,
            self.all_users_page.number_of_editable_users_for_role(
                'Administrator'),
            'Expected Administrators to be non-editable but was editable')
        self.assertEqual(
            0,
            self.all_users_page.number_of_editable_users_for_role(
                'Super Admin'),
            'Expected Super Admin to be non-editable but was editable')
        self.add_user_page = self.all_users_page.navigate_to_add_user()
        self.add_user_page.select_questionnaires(2)
        self.add_user_page.add_user_with(new_user)
        self.add_user_page.get_success_message()
        username = fetch_(USERNAME, new_user)
        self.driver.go_to(ALL_USERS_URL)
        self.assertGreater(
            1,
            self.all_users_page.number_of_editable_users_for_role(
                'Super Admin'),
            'Expected Super Admin to be non-editable but was editable')
        self.assertTrue(
            self.all_users_page.is_editable(username),
            '%s user was expected to be editable but was not editable')
        questionnaire_list_for_user = self.all_users_page.get_questionnaire_list_for(
            username)
        time.sleep(10)
        self.all_users_page.select_user_with_username(username)
        edit_user_page = self.all_users_page.select_edit_action()
        self.assertTrue(edit_user_page.is_user_name_is_prefetched(username))
        self.assertTrue(edit_user_page.is_role_project_manager())
        qre_pre_selected = edit_user_page.are_questionnaires_preselected(
            questionnaire_list_for_user, True)
        self.assertTrue(qre_pre_selected)
        selected_questionnaires = edit_user_page.select_questionnaires(3)
        edit_user_page.save_changes({
            "mobile_phone": random_number(9),
            "full_name": 'New User Name'
        })
        success_message = edit_user_page.get_success_message()
        self.assertEqual(
            USER_EDITED_SUCCESS_MESSAGE, success_message,
            'Expected "User has been updated successfully" message but was not found'
        )

        self.driver.go_to(ALL_USERS_URL)
        self.assertEqual('New User Name',
                         self.all_users_page.get_full_name_for(username))
        self.assertEqual(
            3, len(selected_questionnaires),
            'Expected the questionnaires length to be 3 but was %s' %
            len(selected_questionnaires))
Esempio n. 18
0
                     SMS: "cli002 .EID cid002 . .NA Mr. Dessy .FA 58 .. .RD 17.05.2011 .BG b .SY ade .  .GPS 27.178057  -78.007789 .RM ac",
                     ERROR_MSG: THANKS}#+ " cid002 NA: Mr. Dessy FA: 58 RD: 17.05.2011 BG: O- SY: Rapid weight loss,Memory loss,Neurological disorders GPS: 27.178057, -78.007789 RM: Hivid,Vidéx EC"}

PLUS_IN_THE_BEGINNING = {SENDER: "1234567890",
                         RECEIVER: "919880734937",
                         SMS: ". .cli002 .EID CID005 .NA Mr. Fessy .FA 58 .RD 17.05.2011 .BG b .SY ade .RM ac",
                         ERROR_MSG: "Error: SMS Incorrect. Please review printed questionnaire and resend entire SMS."}

UNREGISTERED_FROM_NUMBER = {SENDER: "123445567",
                            RECEIVER: "919880734937",
                            SMS: "cli002 .EID CID005 . .NA Mr. Kessy .FA 58 .RD 17.05.2011 .BG b .SY ade .GPS 27.178057  -78.007789 .RM ac",
                            ERROR_MSG: "Error. You are not authorized to submit data for this Questionnaire. Please contact your supervisor."}

REGISTER_DATA_SENDER = {SENDER: "1234567890",
                        RECEIVER: "919880734937",
                        SMS: "REG .t Reporter .m %s .L  Jaipur .g 26.917 75.817 .N Donald Duck" % random_number(9),
                        ERROR_MSG: u"Thank you Shweta. We registered your Reporter "}

REGISTER_DATA_SENDER_FROM_UNKNOWN_NUMBER = {SENDER: "12345678453",
                                            RECEIVER: "919880734937",
                                            SMS: "REG .t Reporter .m 0123456789 .L   Jaipur .g 26.917 75.817 .N Mr. McDuck .s rep100000",
                                            ERROR_MSG: "Error. You are not registered as a Data Sender. Please contact your supervisor."}

REGISTER_NEW_SUBJECT = {SENDER: "1234567890",
                        RECEIVER: "919880734937",
                        SMS: "cli clinicf clinicl Jaipur 26.917,75.817 123456",
                        SUCCESS_MESSAGE: "Thank you Shweta"}

REGISTER_NEW_SUBJECT_TO_SOFT_DELETE = {SENDER: "1234567890",
                        RECEIVER: "919880734937",
                        SMS: "cli clinicf clinicl Jaipur 26.917,75.817 123456",
Esempio n. 19
0
    SUCCESS_MESSAGE: "Your changes have been saved."
}

VALID_DATA_FOR_PROJECT = {
    PROJECT_NAME: "Waterpoint morondava",
    GEN_RANDOM: True,
    PROJECT_BACKGROUND:
    "This project is created by functional automation suite.",
    SUBJECT: "waterpoint",
    REPORT_TYPE: 'other subject',
    DEVICES: "sms",
    PAGE_TITLE: "Subjects"
}

VALID_DATA_FOR_SUBJECT_QUESTIONNAIRE = {PAGE_TITLE: "Questionnaire"}
random_number(8)
VALID_DATA_FOR_DATA_SENDER_QUESTIONNAIRE = {PAGE_TITLE: "Reminders"}
random_number(8)
VALID_DATA_FOR_REMINDER = {PAGE_TITLE: "Review & Test"}

QUESTIONNAIRE_DATA = {
    QUESTIONNAIRE_CODE:
    "WPS01",
    GEN_RANDOM:
    False,
    DEFAULT_QUESTION: {
        QUESTION: "What are you reporting on?",
        CODE: "q1"
    },
    QUESTIONS: [
        {
import os

from django.test import Client
from nose.plugins.attrib import attr
from openpyxl import load_workbook

from framework.base_test import HeadlessRunnerTest, teardown_driver
from pages.globalnavigationpage.global_navigation_page import GlobalNavigationPage
from pages.loginpage.login_page import login
from framework.utils.common_utils import random_number

workbook_row1 = {
    'ds_name':
    "FName" + random_number(2),
    'ds_number':
    random_number(6),
    'ds_location':
    "Loc" + random_number(2),
    'gps_coordinates':
    '%.1f, ' % float(random_number(1)) + '%.1f' % float(random_number(1)),
    'ds_email':
    'DsEmail' + random_number(3) + "@dw.com"
}

workbook_row2 = {
    'ds_name':
    "FName" + random_number(2),
    'ds_number':
    random_number(6),
    'ds_location':
    "Loc" + random_number(2),
            QUESTION: u"Bacterias in water",
            CODE: u"q9",
            TYPE: LIST_OF_CHOICES,
            CHOICE: ["Aquificae", "Bacteroids", "Chlorobia"],
            ALLOWED_CHOICE: MULTIPLE_ANSWERS
        },
        {
            QUESTION: u"Geo points of Well",
            CODE: u"q10",
            TYPE: GEO
        },
        {
            QUESTION: u"Unique Id question",
            CODE: u"q11",
            TYPE: UNIQUE_ID,
            NEW_UNIQUE_ID_TYPE: 'new type' + random_number(3),
            EXISTING_UNIQUE_ID_TYPE: ''
        },
    ],
    CHARACTER_REMAINING:
    "69 / 160 characters used (1 SMS)",
    PAGE_TITLE:
    "Data Senders"
}

QUESTIONNAIRE_TAB_PROJECT_DATA = {
    PROJECT_NAME: "ft-edit simple project",
    GEN_RANDOM: True,
}

QUESTIONNAIRE_TAB_QUESTIONNAIRE_DATA = {
Esempio n. 22
0
from framework.utils.common_utils import random_number, random_string

TITLE = "title"
NAME = "full_name"
USERNAME = "******"
MOBILE_PHONE = "mobile_phone"
ADD_USER_DATA = {
    TITLE: "Developer",
    NAME: "Mino Rakoto",
    USERNAME: random_string(7)+"@mailinator.com",
    MOBILE_PHONE: random_number(9)
}
ADDED_USER_SUCCESS_MSG = u'User has been added successfully'
DASHBOARD_PAGE_TITLE = u'Dashboard'
DEFAULT_PASSWORD = "******"
import os

from django.test import Client
from nose.plugins.attrib import attr
from openpyxl import load_workbook

from framework.base_test import HeadlessRunnerTest, teardown_driver
from pages.globalnavigationpage.global_navigation_page import GlobalNavigationPage
from pages.loginpage.login_page import login
from framework.utils.common_utils import random_number

workbook_row1 = {
    'ds_name':
    "FName" + random_number(2),
    'ds_number':
    random_number(6),
    'ds_location':
    "Loc" + random_number(2),
    'gps_coordinates':
    '%.1f, ' % float(random_number(1)) + '%.1f' % float(random_number(1)),
    'ds_email':
    'DsEmail' + random_number(3) + "@dw.com"
}

workbook_row2 = {
    'ds_name':
    "FName" + random_number(2),
    'ds_number':
    random_number(6),
    'ds_location':
    "Loc" + random_number(2),
import os

from nose.plugins.attrib import attr
from openpyxl import load_workbook
from django.test import Client

from framework.base_test import HeadlessRunnerTest
from pages.loginpage.login_page import login
from tests.logintests.login_data import VALID_CREDENTIALS
from framework.utils.common_utils import random_number

workbook1 = {
    'subject_first_name':
    "FName" + random_number(2),
    'subject_last_name':
    "LName" + random_number(2),
    'subject_location':
    "Loc" + random_number(2),
    'subject_gps':
    '%.1f, ' % float(random_number(1)) + '%.1f' % float(random_number(1)),
    'subject_mobile_number':
    random_number(6)
}

workbook2 = {
    'subject_first_name':
    "FName" + random_number(2),
    'subject_last_name':
    "LName" + random_number(2),
    'subject_location':
    "Loc" + random_number(2),
Esempio n. 25
0
    RECEIVER:
    "919880734937",
    SMS:
    "cli002 .EID CID005 . .NA Mr. Kessy .FA 58 .RD 17.05.2011 .BG b .SY ade .GPS 27.178057  -78.007789 .RM ac",
    ERROR_MSG:
    "Your telephone number is not yet registered in our system. Please contact your supervisor."
}

REGISTER_DATA_SENDER = {
    SENDER:
    "1234567890",
    RECEIVER:
    "919880734937",
    SMS:
    "REG .t Reporter .m %s .L  Jaipur .g 26.917 75.817 .N Donald Duck" %
    random_number(9),
    ERROR_MSG:
    u"Thank you Shweta, We registered your reporter: Reporter; "
}

REGISTER_DATA_SENDER_FROM_UNKNOWN_NUMBER = {
    SENDER:
    "12345678453",
    RECEIVER:
    "919880734937",
    SMS:
    "REG .t Reporter .m 0123456789 .L   Jaipur .g 26.917 75.817 .N Mr. McDuck .s rep100000",
    ERROR_MSG:
    "Your telephone number is not yet registered in our system. Please contact your supervisor."
}
Esempio n. 26
0
                                  {QUESTION: u"Water Level", CODE: u"q4", TYPE: NUMBER, MIN: u"1", MAX: u"1000"},
                                  {QUESTION: u"Date of report in MM.YYY format", CODE: u"q5", TYPE: DATE,
                                   DATE_FORMAT: MM_YYYY},
                                  {QUESTION: u"Date of report in MM.DD.YYY format", CODE: u"q6", TYPE: DATE,
                                   DATE_FORMAT: MM_DD_YYYY},
                                  {QUESTION: u"Color of Water", CODE: u"q7", TYPE: LIST_OF_CHOICES,
                                   CHOICE: ["LIGHT RED", "LIGHT YELLOW", "DARK YELLOW"],
                                   ALLOWED_CHOICE: ONLY_ONE_ANSWER},
                                  {QUESTION: u"Water point admin name", CODE: u"q8", TYPE: WORD, LIMIT: LIMITED,
                                   MAX: u"10"},
                                  {QUESTION: u"Bacterias in water", CODE: u"q9", TYPE: LIST_OF_CHOICES,
                                   CHOICE: ["Aquificae", "Bacteroids", "Chlorobia"],
                                   ALLOWED_CHOICE: MULTIPLE_ANSWERS},
                                  {QUESTION: u"Geo points of Well", CODE: u"q10", TYPE: GEO},
                                 {QUESTION: u"Unique Id question", CODE: u"q11", TYPE: UNIQUE_ID,
                                  NEW_UNIQUE_ID_TYPE: 'new type'+random_number(3), EXISTING_UNIQUE_ID_TYPE: ''},
                                  ],
                      CHARACTER_REMAINING: "69 / 160 characters used (1 SMS)",
                      PAGE_TITLE: "Data Senders"
                     }

QUESTIONNAIRE_TAB_PROJECT_DATA = {
                      PROJECT_NAME: "ft-edit simple project", GEN_RANDOM: True,
                    }

QUESTIONNAIRE_TAB_QUESTIONNAIRE_DATA = {
                      QUESTIONNAIRE_CODE: None, GEN_RANDOM: False,
                      DEFAULT_QUESTION: {QUESTION: "What are you reporting on?", CODE: "q1"},
                      QUESTIONS: [{QUESTION: u"Some other Water Level", CODE: u"q1", TYPE: NUMBER, MIN: u"1", MAX: u"1000"}],
                      CHARACTER_REMAINING: "69 / 160 characters used (1 SMS)",
                      PAGE_TITLE: "Data Senders"
Esempio n. 27
0
WEB_CHANNEL = False
EMAIL_ADDRESS = ""
SUCCESS_MSG = "message"
ERROR_MSG = "message"

BLANK_FIELDS = {
    NAME: "",
    MOBILE_NUMBER: "",
    COMMUNE: "",
    GPS: "",
    ERROR_MSG: "This field is required."
}

VALID_DATA = {
    NAME: "ab Mickey Duck",
    MOBILE_NUMBER: random_number(9),
    MOBILE_NUMBER_WITHOUT_HYPHENS: "98765432101",
    COMMUNE: "MAHAVELO,AMBOTAKA,MANAKARA ATSIMO,VATOVAVY FITOVINANY",
    GPS: "-21.7622088847 48.0690991394",
    SUCCESS_MSG: "Your Contact has been successfully added. ID is: rep"
}

VALID_EDIT_DATA = {
    NAME: "EDIT Mickey Duck",
    MOBILE_NUMBER: random_number(9),
    COMMUNE: "PUNE,Madagascar",
    GPS: "",
    SUCCESS_MSG: "Your changes have been saved."
}

VALID_DATA_WITH_EMAIL = {
PAGE_TITLE_IN_FRENCH = "Journal de Soumission"
FIRST_PROJECT_NAME = "clinic test project1"
DELETE_SUBMISSION_WARNING_MESSAGE = u'Your Submission(s) will be moved to Deleted Submissions.\nThis action cannot be undone.\n\nAre you sure you want to continue?'
EXPECTED_FA_LIST = [
    '89.0', '77', '77', '89.0', '77', '58', '27', '58', '98', '37', '28', '78',
    '28', '45', '56', '89', '88', '88', '36', '69', '45', '91', '43', '32',
    '35'
]

EXPECTED_FA_SORTED = [
    '24', '27', '28', '28', '30', '32', '34', '34', '34', '34', '34', '35',
    '36', '37', '37', '38', '38', '38', '43', '45', '45', '45', '47', '47',
    '48'
]

MOBILE_NUMBER_RANDOM = random_number(9)

DATASENDER_DETAILS = {
    NAME: "Dookudu",
    MOBILE_NUMBER: MOBILE_NUMBER_RANDOM,
    COMMUNE: "MAHAVELO,AMBOTAKA,MANAKARA ATSIMO,VATOVAVY FITOVINANY",
    EMAIL_ADDRESS: random_string(5) + '@' + random_string(3) + '.com',
    GPS: "-21.7622088847 48.0690991394",
    SUCCESS_MSG: "Registration successful. ID is: rep"
}

VALID_DATA = {
    SENDER: MOBILE_NUMBER_RANDOM,
    RECEIVER: '919880734937',
    SMS:
    "cli001 .EID cid003 .NA Mr. Tessy .FA 38 .RD 17.01.2012 .BG b .SY ade .GPS 27.178057 -78.007789 .RM a",
DELETE_DS_WITHOUT_SELECTING_DS = {PROJECT_NAME: "clinic test project1", ERROR_MSG: ERROR_MSG_WITHOUT_SELECTING_DS}

VALID_SMS = {SENDER: "919049008976",
             RECEIVER: '919880734937',
             SMS: "cli001 .EID cid003 .NA Mr. Pitt .FA 77 .RD 12.03.2007 .BG b .SY ade .GPS 27.178057 -78.007789 .RM ac",
             SUCCESS_MESSAGE: THANKS}#+ u" EID: cid003 NA: Mr. Pitt FA: 77 RD: 12.03.2007 BG: O- SY: Rapid weight loss,Memory loss,Neurological disorders GPS: 27.178057, -78.007789 RM: Hivid,Vidéx EC"}

VALID_DATA = {NAME: "ReRegistered",
              MOBILE_NUMBER: "919049008976",
              COMMUNE: "MAHAVELO,AMBOTAKA,MANAKARA ATSIMO,VATOVAVY FITOVINANY",
              GPS: "-21.7622088847 48.0690991394",
              SUCCESS_MSG: "Registration successful. ID is: rep"}

VALID_DATASENDER_WITHOUT_WEB_ACCESS = {NAME: "aaa Kimi",
                                       MOBILE_NUMBER: random_number(9),
                                       EMAIL_ADDRESS: generate_random_email_id(),
                                       COMMUNE: "MAHAVELO,AMBOTAKA,MANAKARA ATSIMO,VATOVAVY FITOVINANY",
                                       GPS: "-21.7622088847 48.0690991394",
                                       SUCCESS_MSG: "Registration successful. ID is: rep"}

DATA_SENDER_TO_DELETE = {NAME: "ALLDSDelete",
                         MOBILE_NUMBER: random_number(9),
                         COMMUNE: "MAHAVELO,AMBOTAKA,MANAKARA ATSIMO,VATOVAVY FITOVINANY",
                         GPS: "-21.7622088847 48.0690991394",
                         SUCCESS_MSG: "Registration successful. ID is: rep"}

DATA_SENDER_FOR_MULTIPLE_DELETE = {NAME: "ALLDSDelete",
                                   MOBILE_NUMBER: random_number(9),
                                   COMMUNE: "MAHAVELO,AMBOTAKA,MANAKARA ATSIMO,VATOVAVY FITOVINANY",
                                   GPS: "-21.7622088847 48.0690991394",
PAGE_TITLE_IN_FRENCH = "Journal de Soumission"
FIRST_PROJECT_NAME = "clinic test project1"
DELETE_SUBMISSION_WARNING_MESSAGE = u'Your Submission(s) will be moved to Deleted Submissions.\nThis action cannot be undone.\n\nAre you sure you want to continue?'
EXPECTED_FA_LIST = [
    '89.0', '77', '77', '89.0', '77', '58', '27', '58', '98', '37', '28', '78',
    '28', '45', '56', '89', '88', '88', '36', '69', '45', '91', '43', '32',
    '35'
]

EXPECTED_FA_SORTED = [
    '24', '27', '28', '28', '30', '32', '34', '34', '34', '34', '34', '35',
    '36', '37', '37', '38', '38', '38', '43', '45', '45', '45', '47', '47',
    '48'
]

MOBILE_NUMBER_RANDOM = random_number(9)

DATASENDER_DETAILS = {
    NAME: "Dookudu",
    MOBILE_NUMBER: MOBILE_NUMBER_RANDOM,
    COMMUNE: "MAHAVELO,AMBOTAKA,MANAKARA ATSIMO,VATOVAVY FITOVINANY",
    EMAIL_ADDRESS: random_string(5) + '@' + random_string(3) + '.com',
    GPS: "-21.7622088847 48.0690991394",
    SUCCESS_MSG: "Registration successful. ID is: rep"
}

VALID_DATA = {
    SENDER: MOBILE_NUMBER_RANDOM,
    RECEIVER: '919880734937',
    SMS:
    "cli001 .EID cid003 .NA Mr. Tessy .FA 38 .RD 17.01.2012 .BG b .SY ade .GPS 27.178057 -78.007789 .RM a",