mirror of
				https://github.com/ansible-collections/community.general.git
				synced 2025-10-24 21:14:00 -07:00 
			
		
		
		
	Split basic units (#33510)
Split the one monolithic test for basic.py into several files * Split test_basic.py along categories. This is preliminary to get a handle on things. Eventually we may want to further split it so each file is only testing a single function. * Cleanup unused imports from splitting test_basic.py * Port atomic_move test to pytest. Working on getting rid of need to maintain procenv * Split a test of symbolic_mode_to_octal to follow unittest best practices Each test should only invoke the function under test once * Port test_argument_spec to pytest. * Fix suboptions failure
This commit is contained in:
		
					parent
					
						
							
								ba32827f3b
							
						
					
				
			
			
				commit
				
					
						370a7ace4b
					
				
			
		
					 16 changed files with 1330 additions and 1359 deletions
				
			
		
							
								
								
									
										31
									
								
								test/units/module_utils/basic/test_dict_converters.py
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										31
									
								
								test/units/module_utils/basic/test_dict_converters.py
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,31 @@ | |||
| # -*- coding: utf-8 -*- | ||||
| # (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com> | ||||
| # (c) 2016 Toshio Kuratomi <tkuratomi@ansible.com> | ||||
| # (c) 2017 Ansible Project | ||||
| # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) | ||||
| 
 | ||||
| from __future__ import absolute_import, division, print_function | ||||
| __metaclass__ = type | ||||
| 
 | ||||
| from units.mock.procenv import ModuleTestCase | ||||
| 
 | ||||
| from ansible.module_utils.six.moves import builtins | ||||
| 
 | ||||
| realimport = builtins.__import__ | ||||
| 
 | ||||
| 
 | ||||
| class TestTextifyContainers(ModuleTestCase): | ||||
|     def test_module_utils_basic_json_dict_converters(self): | ||||
|         from ansible.module_utils.basic import json_dict_unicode_to_bytes, json_dict_bytes_to_unicode | ||||
| 
 | ||||
|         test_data = dict( | ||||
|             item1=u"Fóo", | ||||
|             item2=[u"Bár", u"Bam"], | ||||
|             item3=dict(sub1=u"Súb"), | ||||
|             item4=(u"föo", u"bär", u"©"), | ||||
|             item5=42, | ||||
|         ) | ||||
|         res = json_dict_unicode_to_bytes(test_data) | ||||
|         res2 = json_dict_bytes_to_unicode(res) | ||||
| 
 | ||||
|         self.assertEqual(test_data, res2) | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue