<s> from st2common . models . db . marker import DumperMarkerDB <EOL> from st2common . persistence . marker import DumperMarker <EOL> from st2common . util import date as date_utils <EOL> from st2tests import DbTestCase <EOL> class DumperMarkerModelTest ( DbTestCase ) : <EOL> def test_dumper_marker_crud ( self ) : <EOL> saved = DumperMarkerModelTest . _create_save_dumper_marker ( ) <EOL> retrieved = DumperMarker . get_by_id ( saved . id ) <EOL> self . assertEqual ( saved . marker , retrieved . marker , <EOL> '<STR_LIT>' ) <EOL> time_now = date_utils . get_datetime_utc_now ( ) <EOL> retrieved . updated_at = time_now <EOL> saved = DumperMarker . add_or_update ( retrieved ) <EOL> retrieved = DumperMarker . get_by_id ( saved . id ) <EOL> self . assertEqual ( retrieved . updated_at , time_now , '<STR_LIT>' ) <EOL> DumperMarkerModelTest . _delete ( [ retrieved ] ) <EOL> try : <EOL> retrieved = DumperMarker . get_by_id ( saved . id ) <EOL> except ValueError : <EOL> retrieved = None <EOL> self . assertIsNone ( retrieved , '<STR_LIT>' ) <EOL> @ staticmethod <EOL> def _create_save_dumper_marker ( ) : <EOL> created = DumperMarkerDB ( ) <EOL> created . marker = '<STR_LIT>' <EOL> created . updated_at = date_utils . get_datetime_utc_now ( ) <EOL> return DumperMarker . add_or_update ( created ) <EOL> @ staticmethod <EOL> def _delete ( model_objects ) : <EOL> for model_object in model_objects : <EOL> model_object . delete ( ) </s>
