Exemplo n.º 1
0
 def test_get_instance_trigram_returns_trigram_if_trigram_exists(self):
     # Given
     name_tri='AGR-test'
     name_quadri='PADE-test'
     # When
     trigram = bu.get_instance_trigram(name_tri)
     quadrigram = bu.get_instance_trigram(name_quadri)
     # Then
     assert trigram=='AGR'
     assert quadrigram=='PADE'
Exemplo n.º 2
0
 def test_get_instance_trigram_returns_none_if_name_is_none(self):
     # Given
     name=None
     # When
     trigram = bu.get_instance_trigram(name)
     # Then
     assert trigram==None
Exemplo n.º 3
0
 def test_get_instance_trigram_returns_none_if_no_trigram_exists(self):
     # Given
     name='workernode'
     # When
     trigram = bu.get_instance_trigram(name)
     # Then
     assert trigram==None
Exemplo n.º 4
0
 def test_get_instance_trigram_returns_uppercase_trigram(self):
     # Given
     name='agr-test'
     # When
     trigram = bu.get_instance_trigram(name)
     # Then
     assert trigram=='AGR'
Exemplo n.º 5
0
def extract_instance_information(instance):
    information = {}
    information['Id'] = utils.get_instance_id(instance)
    information['Name'] = utils.get_instance_name_from_tags(instance['Tags'])
    information['Trigram'] = utils.get_instance_trigram(information['Name'])
    information['LastActionDate'] = utils.get_instance_last_action_date(instance)
    information['LaunchDate'] = instance['LaunchTime'].date()
    information['Stopped'] = utils.is_instance_stopped(instance)

    return information