<s> """<STR_LIT>""" <EOL> import json <EOL> import unittest <EOL> from cloudcafe . compute . events . models . instance_exists import ( <EOL> InstanceExists ) <EOL> class BaseInstanceActionsTest ( unittest . TestCase ) : <EOL> @ classmethod <EOL> def setUpClass ( cls ) : <EOL> super ( BaseInstanceActionsTest , cls ) . setUpClass ( ) <EOL> cls . bandwidth_interface_dict = { <EOL> "<STR_LIT>" : <NUM_LIT> , <EOL> "<STR_LIT>" : <NUM_LIT> <EOL> } <EOL> cls . bandwidth_dict = { <EOL> "<STR_LIT>" : cls . bandwidth_interface_dict , <EOL> "<STR_LIT>" : cls . bandwidth_interface_dict <EOL> } <EOL> cls . image_meta_dict = { <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT>" <EOL> } <EOL> cls . base_instance_exists_dict = { <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : None , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : None , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : <NUM_LIT:20> , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : <NUM_LIT:0> , <EOL> "<STR_LIT:host>" : None , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : cls . image_meta_dict , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : <NUM_LIT> , <EOL> "<STR_LIT>" : { } , <EOL> "<STR_LIT>" : None , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : <NUM_LIT:20> , <EOL> "<STR_LIT:state>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : <NUM_LIT:1> <EOL> } <EOL> cls . instance_exists_dict = { <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : cls . bandwidth_dict <EOL> } <EOL> cls . instance_exists_dict . update ( cls . base_instance_exists_dict ) <EOL> cls . instance_exists_obj = InstanceExists . _dict_to_obj ( <EOL> cls . instance_exists_dict ) <EOL> class InstanceExistsTest ( BaseInstanceActionsTest ) : <EOL> def test_instance_exists_valid_json ( self ) : <EOL> """<STR_LIT>""" <EOL> expected_obj = self . instance_exists_obj <EOL> actual_json = json . dumps ( self . instance_exists_dict ) <EOL> actual_obj = InstanceExists . deserialize ( actual_json , '<STR_LIT>' ) <EOL> self . assertEqual ( expected_obj , actual_obj ) <EOL> self . assertFalse ( actual_obj . is_empty ( ) ) <EOL> def test_instance_exists_missing_attribute_json ( self ) : <EOL> """<STR_LIT>""" <EOL> modified_dict = self . instance_exists_dict . copy ( ) <EOL> modified_dict . popitem ( ) <EOL> actual_json = json . dumps ( modified_dict ) <EOL> actual_obj = InstanceExists . deserialize ( actual_json , '<STR_LIT>' ) <EOL> self . assertIsNone ( actual_obj ) <EOL> def test_instance_exists_extra_attribute_json ( self ) : <EOL> """<STR_LIT>""" <EOL> modified_dict = self . instance_exists_dict . copy ( ) <EOL> modified_dict [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> actual_json = json . dumps ( modified_dict ) <EOL> actual_obj = InstanceExists . deserialize ( actual_json , '<STR_LIT>' ) <EOL> self . assertIsNone ( actual_obj ) </s>
