Ejemplo n.º 1
0
"""
testing hubspot3.deals
"""
import pytest
from hubspot3.forms import FormsClient, FormSubmissionClient
from hubspot3.error import HubspotNotFound
from hubspot3.test.globals import TEST_KEY

FORMS = FormsClient(api_key=TEST_KEY)
FORM_SUBMISSION = FormSubmissionClient(api_key=TEST_KEY)

# since we need to have an id to submit and to attempt to get a form,
# we need to be hacky here and fetch one upon loading this file.
BASE_FORM = FORMS.get_all(limit=1)[0]


def test_get_form():
    """
    attempts to get a form by id
    :see: https://developers.hubspot.com/docs/methods/forms/v2/get_form
    """
    with pytest.raises(HubspotNotFound):
        FORMS.get("not_a_form_id")

    form = FORMS.get(BASE_FORM["guid"])
    assert form
    assert isinstance(form, dict)


def test_get_all_forms():
    """
Ejemplo n.º 2
0
    def form_submissions(self):
        """returns a hubspot3 form submissions client"""
        from hubspot3.forms import FormSubmissionClient

        return FormSubmissionClient(**self.auth, **self.options)