From f9742ab41d6f75d44f853b7767b37f30fb289512 Mon Sep 17 00:00:00 2001 From: Matthias Date: Sun, 9 Jan 2022 03:34:27 +0100 Subject: [PATCH] add integration test for plugin --- .../samples/integration/test_api_caller.py | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 InvenTree/plugin/samples/integration/test_api_caller.py diff --git a/InvenTree/plugin/samples/integration/test_api_caller.py b/InvenTree/plugin/samples/integration/test_api_caller.py new file mode 100644 index 0000000000..7db431c3ee --- /dev/null +++ b/InvenTree/plugin/samples/integration/test_api_caller.py @@ -0,0 +1,20 @@ +""" Unit tests for action caller sample""" + +from django.test import TestCase + +from plugin import plugin_registry + +class SampleApiCallerPluginTests(TestCase): + """ Tests for SampleApiCallerPluginTests """ + + def test_return(self): + """check if the external api call works""" + # The plugin should be defined + self.assertIn('sample-api-caller', plugin_registry.plugins) + plg = plugin_registry.plugins['sample-api-caller'] + self.assertTrue(plg) + + # do an api call + result = plg.get_external_url() + self.assertTrue(result) + self.assertIn('data', result,)