def start_poll_queues_messages_in_table(driver):

    group = create_group(group_name='groupFT')
    user1 = create_user(username="******",email='*****@*****.**', group=group)
    user2 = create_user(username='******', email='*****@*****.**', group=group)

    contact1 = Contact.objects.create(pk=999, name='FT1', user=user1, gender='M', birthdate=datetime.now(), language="en")
    contact2 = Contact.objects.create(pk=1000, name='FT2', user=user2, gender='M', birthdate=datetime.now(), language="en")
    contacts = [contact1, contact2]

    backend = Backend.objects.create(name='test_backend')
    create_connection(identity='0794339344', contact=contact1, backend=backend)
    create_connection(identity='0794339427', contact=contact2, backend=backend)

    poll = create_poll(user2)
    add_contacts_to_poll(poll, contacts)

    driver.create_and_sign_in_admin("argha", "a")

    driver.open("/view_poll/%s" % poll.id)
    driver.browser.find_link_by_text('Start Poll').first.click()

    assert driver.browser.is_text_present('Close Poll')

    return poll.id, poll.contacts.count()
Exemplo n.º 2
0
def create_polls_with_fake_responses(number_of_polls):
    group = create_group(group_name='Pagination Group')
    user1 = create_user(username="******", email='*****@*****.**', group=group)
    user2 = create_user(username='******', email='*****@*****.**', group=group)

    contact1 = Contact.objects.create(pk=567, name='FT1', user=user1, gender='M', birthdate=datetime.now(), language="en")
    contact2 = Contact.objects.create(pk=765, name='FT2', user=user2, gender='M', birthdate=datetime.now(), language="en")
    contacts = [contact1, contact2]

    backend = Backend.objects.create(name='dmark')

    connection1 = create_connection('0794339344', contact1, backend)
    connection2 = create_connection('0794339427', contact2, backend)
    connections = [connection1, connection2]

    polls = []
    for poll in range(1, number_of_polls):
        poll = create_poll(user1)
        add_contacts_to_poll(poll, contacts)
        poll.add_yesno_categories()
        poll.save()
        polls.append(poll)

        for connection in connections:
            create_fake_response(connection, 'yes')

    return polls
Exemplo n.º 3
0
    def setUp(self):
        self.browser = BROWSER

        group = create_group(group_name='poll_status_group')

        user1 = create_user(username="******", email='*****@*****.**', group=group)
        user2 = create_user(username='******',
                            email='*****@*****.**',
                            group=group)

        contact1 = Contact.objects.create(pk=999,
                                          name='poll_status_contact_1',
                                          user=user1,
                                          gender='M',
                                          birthdate=datetime.now(),
                                          language="en")
        contact2 = Contact.objects.create(pk=1000,
                                          name='poll_status_contact_2',
                                          user=user2,
                                          gender='M',
                                          birthdate=datetime.now(),
                                          language="en")
        contacts = [contact1, contact2]

        backend = Backend.objects.create(name='PS_BACKEND')
        create_connection(identity='0794335546',
                          contact=contact1,
                          backend=backend)
        create_connection(identity='0794335529',
                          contact=contact2,
                          backend=backend)

        self.poll = create_poll(user2)
        add_contacts_to_poll(self.poll, contacts)

        self.poll.add_yesno_categories()

        self.create_and_sign_in_admin("argha", "a")

        self.open("/poll_status/%s" % self.poll.id)
def start_poll_queues_messages_in_table(driver):

    group = create_group(group_name='groupFT')
    user1 = create_user(username="******", email='*****@*****.**', group=group)
    user2 = create_user(username='******',
                        email='*****@*****.**',
                        group=group)

    contact1 = Contact.objects.create(pk=999,
                                      name='FT1',
                                      user=user1,
                                      gender='M',
                                      birthdate=datetime.now(),
                                      language="en")
    contact2 = Contact.objects.create(pk=1000,
                                      name='FT2',
                                      user=user2,
                                      gender='M',
                                      birthdate=datetime.now(),
                                      language="en")
    contacts = [contact1, contact2]

    backend = Backend.objects.create(name='test_backend')
    create_connection(identity='0794339344', contact=contact1, backend=backend)
    create_connection(identity='0794339427', contact=contact2, backend=backend)

    poll = create_poll(user2)
    add_contacts_to_poll(poll, contacts)

    driver.create_and_sign_in_admin("argha", "a")

    driver.open("/view_poll/%s" % poll.id)
    driver.browser.find_link_by_text('Start Poll').first.click()

    assert driver.browser.is_text_present('Close Poll')

    return poll.id, poll.contacts.count()
    def setUp(self):
        self.browser = BROWSER

        group = create_group(group_name='poll_status_group')

        user1 = create_user(username="******", email='*****@*****.**', group=group)
        user2 = create_user(username='******', email='*****@*****.**', group=group)

        contact1 = Contact.objects.create(pk=999, name='poll_status_contact_1', user=user1, gender='M', birthdate=datetime.now(), language="en")
        contact2 = Contact.objects.create(pk=1000, name='poll_status_contact_2', user=user2, gender='M', birthdate=datetime.now(), language="en")
        contacts = [contact1, contact2]

        backend = Backend.objects.create(name='PS_BACKEND')
        create_connection(identity='0794335546', contact=contact1, backend=backend)
        create_connection(identity='0794335529', contact=contact2, backend=backend)

        self.poll = create_poll(user2)
        add_contacts_to_poll(self.poll, contacts)

        self.poll.add_yesno_categories()

        self.create_and_sign_in_admin("argha", "a")

        self.open("/poll_status/%s" % self.poll.id)