def test_invalid_enable_email_link_sign_in(self, enable, tenant_mgt_app):
     with pytest.raises(ValueError) as excinfo:
         tenant_mgt.create_tenant(display_name='test',
                                  enable_email_link_sign_in=enable,
                                  app=tenant_mgt_app)
     assert str(
         excinfo.value).startswith('Invalid type for enableEmailLinkSignin')
 def test_invalid_allow_password_sign_up(self, allow, tenant_mgt_app):
     with pytest.raises(ValueError) as excinfo:
         tenant_mgt.create_tenant(display_name='test',
                                  allow_password_sign_up=allow,
                                  app=tenant_mgt_app)
     assert str(
         excinfo.value).startswith('Invalid type for allowPasswordSignup')
    def test_error(self, tenant_mgt_app):
        _instrument_tenant_mgt(tenant_mgt_app, 500, '{}')
        with pytest.raises(exceptions.InternalError) as excinfo:
            tenant_mgt.create_tenant(display_name='test', app=tenant_mgt_app)

        error_msg = 'Unexpected error response: {}'
        assert excinfo.value.code == exceptions.INTERNAL
        assert str(excinfo.value) == error_msg
        assert excinfo.value.http_response is not None
        assert excinfo.value.cause is not None
def create_tenant():
    # [START create_tenant]
    tenant = tenant_mgt.create_tenant(display_name='myTenant1',
                                      enable_email_link_sign_in=True,
                                      allow_password_sign_up=True)

    print('Created tenant:', tenant.tenant_id)
    def test_create_tenant_minimal(self, tenant_mgt_app):
        _, recorder = _instrument_tenant_mgt(tenant_mgt_app, 200,
                                             GET_TENANT_RESPONSE)
        tenant = tenant_mgt.create_tenant(display_name='test',
                                          app=tenant_mgt_app)

        _assert_tenant(tenant)
        self._assert_request(recorder, {'displayName': 'test'})
    def test_create_tenant_false_values(self, tenant_mgt_app):
        _, recorder = _instrument_tenant_mgt(tenant_mgt_app, 200,
                                             GET_TENANT_RESPONSE)
        tenant = tenant_mgt.create_tenant(display_name='test',
                                          allow_password_sign_up=False,
                                          enable_email_link_sign_in=False,
                                          app=tenant_mgt_app)

        _assert_tenant(tenant)
        self._assert_request(
            recorder, {
                'displayName': 'test',
                'allowPasswordSignup': False,
                'enableEmailLinkSignin': False,
            })
Beispiel #7
0
def test_update_tenant():
    tenant = tenant_mgt.create_tenant(display_name='py-update-test',
                                      allow_password_sign_up=True,
                                      enable_email_link_sign_in=True)
    try:
        tenant = tenant_mgt.update_tenant(tenant.tenant_id,
                                          display_name='updated-py-tenant',
                                          allow_password_sign_up=False,
                                          enable_email_link_sign_in=False)
        assert isinstance(tenant, tenant_mgt.Tenant)
        assert tenant.tenant_id == tenant.tenant_id
        assert tenant.display_name == 'updated-py-tenant'
        assert tenant.allow_password_sign_up is False
        assert tenant.enable_email_link_sign_in is False
    finally:
        tenant_mgt.delete_tenant(tenant.tenant_id)
Beispiel #8
0
def test_delete_tenant():
    tenant = tenant_mgt.create_tenant(display_name='py-delete-test')
    tenant_mgt.delete_tenant(tenant.tenant_id)
    with pytest.raises(tenant_mgt.TenantNotFoundError):
        tenant_mgt.get_tenant(tenant.tenant_id)
Beispiel #9
0
def sample_tenant():
    tenant = tenant_mgt.create_tenant(display_name='admin-python-tenant',
                                      allow_password_sign_up=True,
                                      enable_email_link_sign_in=True)
    yield tenant
    tenant_mgt.delete_tenant(tenant.tenant_id)
 def test_invalid_display_name_value(self, display_name, tenant_mgt_app):
     with pytest.raises(ValueError) as excinfo:
         tenant_mgt.create_tenant(display_name=display_name,
                                  app=tenant_mgt_app)
     assert str(excinfo.value).startswith('displayName must start')