mirror of
				https://github.com/inventree/InvenTree.git
				synced 2025-11-04 07:05:41 +00:00 
			
		
		
		
	add integration test for plugin
This commit is contained in:
		
							
								
								
									
										20
									
								
								InvenTree/plugin/samples/integration/test_api_caller.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								InvenTree/plugin/samples/integration/test_api_caller.py
									
									
									
									
									
										Normal file
									
								
							@@ -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,)
 | 
			
		||||
		Reference in New Issue
	
	Block a user