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. """
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.
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. """
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. """