Esempio n. 1
0
def test_request_model_factory_creates_model_correctly():
    model = GCPEntitiesRequestModel(key='lorem',
                                    type='PLAIN_TEXT',
                                    language='en')
    model_name = model.Config.title
    attributes = model.dict()
    restored_model = RequestModelFactory.create(model_name, attributes)
    assert restored_model == model
Esempio n. 2
0
def test_gcp_entities_request(cassettes_path):
    with vcr.use_cassette(str(cassettes_path / 'gcp_entities.yaml'),
                          mode='once',
                          filter_query_parameters=['key']):
        model = GCPEntitiesRequestModel(key=os.environ.get('API_KEY_GCP', ''),
                                        type='PLAIN_TEXT',
                                        language='en')
        response = model.send(text='Google, headquartered in Mountain View')
        assert 'entities' in response
def test_gcp_entities_request_model_create_rest_request():
    model = GCPEntitiesRequestModel(key='lorem',
                                    type='PLAIN_TEXT',
                                    language='en')
    request = model.build()
    assert isinstance(request, RESTRequest)