| 
									
										
										
										
											2015-11-23 14:04:14 +01:00
										 |  |  | from __future__ import unicode_literals | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-11-27 14:14:40 -05:00
										 |  |  | import sure  # noqa | 
					
						
							|  |  |  | from freezegun import freeze_time | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | from moto.core.utils import camelcase_to_underscores, underscores_to_camelcase, unix_time | 
					
						
							| 
									
										
										
										
											2015-11-23 14:04:14 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | def test_camelcase_to_underscores(): | 
					
						
							|  |  |  |     cases = { | 
					
						
							|  |  |  |         "theNewAttribute": "the_new_attribute", | 
					
						
							|  |  |  |         "attri bute With Space": "attribute_with_space", | 
					
						
							|  |  |  |         "FirstLetterCapital": "first_letter_capital", | 
					
						
							| 
									
										
										
										
											2017-03-15 23:39:36 -04:00
										 |  |  |         "ListMFADevices": "list_mfa_devices", | 
					
						
							| 
									
										
										
										
											2015-11-23 14:04:14 +01:00
										 |  |  |     } | 
					
						
							|  |  |  |     for arg, expected in cases.items(): | 
					
						
							|  |  |  |         camelcase_to_underscores(arg).should.equal(expected) | 
					
						
							| 
									
										
										
										
											2015-11-23 14:09:31 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | def test_underscores_to_camelcase(): | 
					
						
							|  |  |  |     cases = { | 
					
						
							|  |  |  |         "the_new_attribute": "theNewAttribute", | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     for arg, expected in cases.items(): | 
					
						
							|  |  |  |         underscores_to_camelcase(arg).should.equal(expected) | 
					
						
							| 
									
										
										
										
											2015-11-27 14:14:40 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | @freeze_time("2015-01-01 12:00:00") | 
					
						
							|  |  |  | def test_unix_time(): | 
					
						
							|  |  |  |     unix_time().should.equal(1420113600.0) |