Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 


Quelle  test_recording.py   Sprache: Python

 
#!/usr/bin/env python
import datetime
import os
from builtins import Exception

import mozinfo
import mozunit
import requests
from mozproxy import get_playback
from support import tempdir

here = os.path.dirname(__file__)
os.environ["MOZPROXY_DIR"] = os.path.join(here, "files")


def get_status_code(url, playback):
    response = requests.get(
        url=url, proxies={"http""http://%s:%s/" % (playback.host, playback.port)}
    )
    return response.status_code


def test_record_and_replay(*args):
    # test setup

    basename = "recording"
    suffix = datetime.datetime.now().strftime("%y%m%d_%H%M%S")
    filename = "_".join([basename, suffix])
    recording_file = os.path.join(here, "files"".".join([filename, "zip"]))

    # Record part
    config = {
        "playback_tool""mitmproxy",
        "recording_file": recording_file,
        "playback_version""8.1.1",
        "platform": mozinfo.os,
        "run_local""MOZ_AUTOMATION" not in os.environ,
        "binary""firefox",
        "app""firefox",
        "host""127.0.0.1",
        "record"True,
    }

    with tempdir() as obj_path:
        config["obj_path"] = obj_path
        record = get_playback(config)
        assert record is not None

        try:
            record.start()

            url = "https://m.media-amazon.com/images/G/01/csm/showads.v2.js"
            assert get_status_code(url, record) == 200
        finally:
            record.stop()

        # playback part
        config["record"] = False
        config["recording_file"] = None
        config["playback_files"] = [recording_file]
        playback = get_playback(config)
        assert playback is not None
        try:
            playback.start()

            url = "https://m.media-amazon.com/images/G/01/csm/showads.v2.js"
            assert get_status_code(url, playback) == 200
        finally:
            playback.stop()

    # Cleanup
    try:
        os.remove(recording_file)
        os.remove(os.path.join("distribution""policies.json"))
    except Exception:
        pass


if __name__ == "__main__":
    mozunit.main(runwith="pytest")

Messung V0.5
C=98 H=97 G=97

¤ Dauer der Verarbeitung: 0.0 Sekunden  (vorverarbeitet)  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Software

     Produkte
     Quellcodebibliothek

Aktivitäten

     Artikel über Sicherheit
     Anleitung zur Aktivierung von SSL

Muße

     Gedichte
     Musik
     Bilder

Jenseits des Üblichen ....
    

Besucherstatistik

Besucherstatistik

Monitoring

Montastic status badge