Пример #1
0
            instance = GengoMock.return_value
            instance.getTranslationOrderJobs.return_value = gtoj_resp
            instance.getTranslationJobBatch.return_value = gtjb_resp

            ght.pull_translations()

            jobs = GengoJob.objects.all()
            assert len(jobs) == 1
            assert jobs[0].status == 'complete'

            orders = GengoOrder.objects.all()
            assert len(orders) == 1
            assert orders[0].status == 'complete'


@pytest.mark.skipif(not has_gengo_creds(), reason='no gengo creds')
class TestGengoLive(TestCase):
    """These are tests that execute calls against the real live Gengo API

    These tests require GENGO_PUBLIC_KEY and GENGO_PRIVATE_KEY to be
    valid values in your settings_local.py file.

    These tests will use the sandbox where possible, but otherwise use
    the real live Gengo API.

    Please don't fake the credentials since then you'll just get API
    authentication errors.

    These tests should be minimal end-to-end tests.

    """
Пример #2
0
            instance = GengoMock.return_value
            instance.getTranslationOrderJobs.return_value = gtoj_resp
            instance.getTranslationJobBatch.return_value = gtjb_resp

            ght.pull_translations()

            jobs = GengoJob.objects.all()
            assert len(jobs) == 1
            assert jobs[0].status == 'complete'

            orders = GengoOrder.objects.all()
            assert len(orders) == 1
            assert orders[0].status == 'complete'


@pytest.mark.skipif(not has_gengo_creds(), reason='no gengo creds')
class TestGengoLive(TestCase):
    """These are tests that execute calls against the real live Gengo API

    These tests require GENGO_PUBLIC_KEY and GENGO_PRIVATE_KEY to be
    valid values in your settings_local.py file.

    These tests will use the sandbox where possible, but otherwise use
    the real live Gengo API.

    Please don't fake the credentials since then you'll just get API
    authentication errors.

    These tests should be minimal end-to-end tests.

    """
Пример #3
0
            instance = GengoMock.return_value
            instance.getTranslationOrderJobs.return_value = gtoj_resp
            instance.getTranslationJobBatch.return_value = gtjb_resp

            ght.pull_translations()

            jobs = GengoJob.objects.all()
            assert len(jobs) == 1
            assert jobs[0].status == 'complete'

            orders = GengoOrder.objects.all()
            assert len(orders) == 1
            assert orders[0].status == 'complete'


@pytest.mark.skipif(not has_gengo_creds(),
                    reason='no gengo creds')
class LiveGengoTestCase(TestCase):
    """These are tests that execute calls against the real live Gengo API

    These tests require GENGO_PUBLIC_KEY and GENGO_PRIVATE_KEY to be
    valid values in your settings_local.py file.

    These tests will use the sandbox where possible, but otherwise use
    the real live Gengo API.

    Please don't fake the credentials since then you'll just get API
    authentication errors.

    These tests should be minimal end-to-end tests.
Пример #4
0
    set up. If you don't, then they're made blank and the tests will
    fail and we will all freeze in an ice storm of biblical
    proportions!

    """
    public_key = getattr(settings, 'GENGO_SANDBOX_PUBLIC_KEY', '')
    private_key = getattr(settings, 'GENGO_SANDBOX_PRIVATE_KEY', '')

    return override_settings(
        GENGO_PUBLIC_KEY=public_key,
        GENGO_PRIVATE_KEY=private_key,
        GENGO_USE_SANDBOX=True
    )(fun)


@skip_if(lambda: not has_gengo_creds())
class LiveGengoTestCase(TestCase):
    """These are tests that execute calls against the real live Gengo API

    These tests require GENGO_PUBLIC_KEY and GENGO_PRIVATE_KEY to be
    valid values in your settings_local.py file.

    These tests will use the sandbox where possible, but otherwise use
    the real live Gengo API.

    Please don't fake the credentials since then you'll just get API
    authentication errors.

    These tests should be minimal end-to-end tests.

    """
Пример #5
0
    This forces the test to use ths Gengo sandbox. This requires that
    you have GENGO_SANDBOX_PUBLIC_KEY and GENGO_SANDBOX_PRIVATE_KEY
    set up. If you don't, then they're made blank and the tests will
    fail and we will all freeze in an ice storm of biblical
    proportions!

    """
    public_key = getattr(settings, 'GENGO_SANDBOX_PUBLIC_KEY', '')
    private_key = getattr(settings, 'GENGO_SANDBOX_PRIVATE_KEY', '')

    return override_settings(GENGO_PUBLIC_KEY=public_key,
                             GENGO_PRIVATE_KEY=private_key,
                             GENGO_USE_SANDBOX=True)(fun)


@skip_if(lambda: not has_gengo_creds())
class LiveGengoTestCase(TestCase):
    """These are tests that execute calls against the real live Gengo API

    These tests require GENGO_PUBLIC_KEY and GENGO_PRIVATE_KEY to be
    valid values in your settings_local.py file.

    These tests will use the sandbox where possible, but otherwise use
    the real live Gengo API.

    Please don't fake the credentials since then you'll just get API
    authentication errors.

    These tests should be minimal end-to-end tests.

    """