Ejemplo n.º 1
0
def test_firestore(capsys):
    context = Context()
    context.resource = 'my-resource'

    data = {'oldValue': {'a': 1}, 'value': {'b': 2}}

    main.hello_firestore(data, context)

    out, _ = capsys.readouterr()

    assert 'Function triggered by change to: my-resource' in out
    assert json.dumps(data['oldValue']) in out
    assert json.dumps(data['value']) in out
def test_firestore(capsys):
    context = Context()
    context.resource = 'my-resource'

    data = {
        'oldValue': {'a': 1},
        'value': {'b': 2}
    }

    main.hello_firestore(data, context)

    out, _ = capsys.readouterr()

    assert 'Function triggered by change to: my-resource' in out
    assert json.dumps(data['oldValue']) in out
    assert json.dumps(data['value']) in out
Ejemplo n.º 3
0
def test_firestore(capsys):
    resource_id = str(uuid.uuid4())

    context = Context()
    context.resource = resource_id

    data = {
        'oldValue': {
            'uuid': str(uuid.uuid4())
        },
        'value': {
            'uuid': str(uuid.uuid4())
        }
    }

    main.hello_firestore(data, context)

    out, _ = capsys.readouterr()

    assert ('Function triggered by change to: %s' % resource_id) in out
    assert json.dumps(data['oldValue']) in out
    assert json.dumps(data['value']) in out