Esempio n. 1
0
def test_populate_google_snapshot(monkeypatch):
    monkeypatch.setattr('processor.connector.snapshot_google.config_value',
                        mock_config_value)
    monkeypatch.setattr('processor.connector.snapshot_google.get_documents',
                        mock_google_get_documents)
    monkeypatch.setattr('processor.connector.snapshot_google.json_source',
                        mock_db_json_source)
    monkeypatch.setattr(
        'processor.connector.snapshot_google.insert_one_document',
        mock_insert_one_document)
    monkeypatch.setattr(
        'processor.connector.snapshot_google.get_google_client_data',
        mock_get_google_client_data)
    monkeypatch.setattr('processor.connector.snapshot_google.get_node',
                        mock_get_node)
    monkeypatch.setattr(
        'processor.connector.snapshot_google.get_collection_size',
        mock_get_collection_size)
    from processor.connector.snapshot_google import populate_google_snapshot
    val = populate_google_snapshot(snapshot)
    assert val == {'71': True}
    monkeypatch.setattr(
        'processor.connector.snapshot_google.get_google_client_data',
        mock_negative_get_google_client_data)
    val = populate_google_snapshot(snapshot)
    assert val == {'71': False}
Esempio n. 2
0
def test_populate_google_snapshot_with_exception(monkeypatch):
    monkeypatch.setattr('processor.connector.snapshot_google.config_value',
                        mock_config_value)
    monkeypatch.setattr('processor.connector.snapshot_google.get_documents',
                        mock_google_get_documents)
    monkeypatch.setattr('processor.connector.snapshot_google.json_source',
                        mock_db_json_source)
    monkeypatch.setattr(
        'processor.connector.snapshot_google.insert_one_document',
        mock_insert_one_document)
    monkeypatch.setattr(
        'processor.connector.snapshot_google.get_google_client_data',
        mock_get_google_client_data)
    monkeypatch.setattr('processor.connector.snapshot_google.get_node',
                        mock_get_node)
    monkeypatch.setattr('processor.connector.snapshot_google.get_dbtests',
                        mock_get_dbtests_false)
    monkeypatch.setattr(
        'processor.connector.snapshot_google.make_snapshots_dir',
        mock_make_snapshots_dir)
    monkeypatch.setattr('processor.connector.snapshot_google.store_snapshot',
                        mock_store_snapshot)
    monkeypatch.setattr(
        'processor.connector.snapshot_google.get_collection_size',
        mock_get_collection_size)
    from processor.connector.snapshot_google import populate_google_snapshot
    val = populate_google_snapshot(snapshot)
def test_exception_populate_google_snapshot(monkeypatch):
    monkeypatch.setattr('processor.connector.snapshot_google.config_value', mock_config_value)
    monkeypatch.setattr('processor.connector.snapshot_google.json_source', mock_db_json_source)
    monkeypatch.setattr('processor.connector.snapshot_google.validate_snapshot_nodes', validate_negative_snapshot_nodes)
    monkeypatch.setattr('processor.connector.snapshot_google.get_documents', mock_google_get_documents)
    from processor.connector.snapshot_google import populate_google_snapshot
    val = populate_google_snapshot(snapshot)
    assert val == None