示例#1
0
def test_create_batch_info(monkeypatch):
    now = datetime.now()
    batch_name = "Name"

    monkeypatch.delenv("APPLITOOLS_BATCH_ID")
    with patch("applitools.common.config.datetime") as mocked_datetime:
        mocked_datetime.now.return_value = now
        bi = BatchInfo(batch_name)
        bi.sequence_name = "sequence name"

    assert bi.name == batch_name
    assert bi.id == PROCESS_DEFAULT_BATCH_ID
    assert bi.started_at == now
    assert bi.sequence_name == "sequence name"
示例#2
0
def test_create_batch_info(monkeypatch):
    uuid_value = str(uuid.uuid4())
    now = datetime.now()
    batch_name = "Name"

    monkeypatch.delenv("APPLITOOLS_BATCH_ID")
    with patch("uuid.uuid4") as mock_uuid:
        mock_uuid.return_value = uuid_value
        with patch("applitools.common.config.datetime") as mocked_datetime:
            mocked_datetime.now.return_value = now
            bi = BatchInfo(batch_name)
            bi.sequence_name = "sequence name"

    assert bi.name == batch_name
    assert bi.id == uuid_value
    assert bi.started_at == now
    assert bi.sequence_name == "sequence name"