pytest.mark.e2e

Here are the examples of the python api pytest.mark.e2e taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

1 Examples 7

Example 1

Project: getting-started-python Source File: test_end_to_end.py
@pytest.mark.e2e
def test_end_to_end():
    """Tests designed to be run against live environments.

    Unlike the integration tests in the other packages, these tests are
    designed to be run against fully-functional live environments.

    To run locally, start both main.py and psq_worker main.books_queue and
    run this file.

    It can be run against a live environment by setting the E2E_URL
    environment variables before running the tests:

        E2E_URL=http://your-app-id.appspot.com \
        nosetests tests/test_end_to_end.py
    """

    base_url = os.environ.get('E2E_URL', 'http://localhost:8080')

    book_data = {
        'title': 'a confederacy of dunces',
    }

    response = requests.post(base_url + '/books/add', data=book_data)

    # There was a 302, so get the book's URL from the redirect.
    book_url = response.request.url
    book_id = book_url.rsplit('/', 1).pop()

    # Wait 30 seconds for pubsub messages to be processed.
    time.sleep(30)

    try:
        # Check that the book's information was updated.
        response = requests.get(book_url)
        assert response.status_code == 200

        soup = BeautifulSoup(response.text, 'html.parser')

        title = soup.find('h4', 'book-title').contents[0].strip()
        assert re.search(r'A Confederacy of Dunces', title, re.I)

        author = soup.find('h5', 'book-author').string
        assert re.search(r'John Kennedy Toole', author, re.I)

        description = soup.find('p', 'book-description').string
        assert re.search(r'Ignatius', description, re.I)

        image_src = soup.find('img', 'book-image')['src']
        image = requests.get(image_src)
        assert image.status_code == 200
    finally:
        # Delete the book we created.
        requests.get(base_url + '/books/{}/delete'.format(book_id))