mirror of
				https://github.com/datahub-project/datahub.git
				synced 2025-10-30 10:14:53 +00:00 
			
		
		
		
	 61a95f41ae
			
		
	
	
		61a95f41ae
		
			
		
	
	
	
	
		
			
			* chore: fix lint and remove incorrect integration mark from unit tests * add to test requirements * revert athena source tests
		
			
				
	
	
		
			45 lines
		
	
	
		
			924 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			45 lines
		
	
	
		
			924 B
		
	
	
	
		
			Python
		
	
	
	
	
	
| import pytest
 | |
| 
 | |
| from datahub.ingestion.source.ldap import parse_from_attrs, strip_ldap_info
 | |
| 
 | |
| 
 | |
| def test_strip_ldap_info():
 | |
| 
 | |
|     assert (
 | |
|         strip_ldap_info(b"uid=firstname.surname,ou=People,dc=internal,dc=machines")
 | |
|         == "firstname.surname"
 | |
|     )
 | |
| 
 | |
| 
 | |
| @pytest.mark.parametrize(
 | |
|     "input, expected",
 | |
|     [
 | |
|         (
 | |
|             {
 | |
|                 "admins": [
 | |
|                     b"uid=A.B,ou=People,dc=internal,dc=machines",
 | |
|                     b"uid=C.D,ou=People,dc=internal,dc=machines",
 | |
|                 ]
 | |
|             },
 | |
|             ["urn:li:corpuser:A.B", "urn:li:corpuser:C.D"],
 | |
|         ),
 | |
|         (
 | |
|             {
 | |
|                 "not_admins": [
 | |
|                     b"doesntmatter",
 | |
|                 ]
 | |
|             },
 | |
|             [],
 | |
|         ),
 | |
|     ],
 | |
| )
 | |
| def test_parse_from_attrs(input, expected):
 | |
| 
 | |
|     assert (
 | |
|         parse_from_attrs(
 | |
|             input,
 | |
|             "admins",
 | |
|         )
 | |
|         == expected
 | |
|     )
 |