@@ -408,7 +408,7 @@ def test_bm_db_version_9(self):
408408 answ = check in sent_schema
409409 self .assertEqual (answ , True , "Column senttime not added to sent table" )
410410
411- check = ['sleeptill' , 'int ' ]
411+ check = ['sleeptill' , 'integer ' ]
412412 answ = check in sent_schema
413413 self .assertEqual (answ , True , "Column sleeptill not added to sent table" )
414414
@@ -451,10 +451,98 @@ def test_bm_db_version_10(self):
451451 res = self .test_db .cur .fetchall ()
452452 self .assertEqual (res , [('' , '' )], "Migration addressbook table data failed" )
453453
454- def test_bm_db_version_type (self ):
454+ def test_upgrade_to_latest (self ):
455455 """
456- Test version type
456+ Test upgrade_to_latest func
457457 """
458- self .test_db .cur .execute ('''INSERT INTO settings VALUES('version','test_string')''' ) # noqa
459- res = self .test_db .sql_schema_version
460- self .assertEqual (type (res ), int )
458+ self .test_db .upgrade_to_latest ()
459+ # check inbox table
460+ res = self .get_table_schema ("inbox" )
461+ check = [['msgid' , 'blob' ],
462+ ['toaddress' , 'text' ],
463+ ['fromaddress' , 'text' ],
464+ ['subject' , 'text' ],
465+ ['received' , 'text' ],
466+ ['message' , 'text' ],
467+ ['folder' , 'text' ],
468+ ['encodingtype' , 'int' ],
469+ ['read' , 'bool' ],
470+ ['sighash' , 'blob' ]]
471+ self .assertEqual (res , check , "inbox table not valid" )
472+
473+ # check sent table
474+ res = self .get_table_schema ("sent" )
475+ check = [['msgid' , 'blob' ],
476+ ['toaddress' , 'text' ],
477+ ['toripe' , 'blob' ],
478+ ['fromaddress' , 'text' ],
479+ ['subject' , 'text' ],
480+ ['message' , 'text' ],
481+ ['ackdata' , 'blob' ],
482+ ['senttime' , 'integer' ],
483+ ['lastactiontime' , 'integer' ],
484+ ['sleeptill' , 'integer' ],
485+ ['status' , 'text' ],
486+ ['retrynumber' , 'integer' ],
487+ ['folder' , 'text' ],
488+ ['encodingtype' , 'int' ],
489+ ['ttl' , 'int' ]]
490+ self .assertEqual (res , check , "sent table not valid" )
491+
492+ # check subscriptions table
493+ res = self .get_table_schema ("subscriptions" )
494+ check = [['label' , 'text' ],
495+ ['address' , 'text' ],
496+ ['enabled' , 'bool' ]]
497+ self .assertEqual (res , check , "subscriptions table not valid" )
498+
499+ # check addressbook table
500+ res = self .get_table_schema ("addressbook" )
501+ check = [['label' , 'text' ],
502+ ['address' , 'text' ]]
503+ self .assertEqual (res , check , "addressbook table not valid" )
504+
505+ # check blacklist table
506+ res = self .get_table_schema ("blacklist" )
507+ check = [['label' , 'text' ],
508+ ['address' , 'text' ],
509+ ['enabled' , 'bool' ]]
510+ self .assertEqual (res , check , "blacklist table not valid" )
511+
512+ # check whitelist table
513+ res = self .get_table_schema ("whitelist" )
514+ check = [['label' , 'text' ],
515+ ['address' , 'text' ],
516+ ['enabled' , 'bool' ]]
517+ self .assertEqual (res , check , "whitelist table not valid" )
518+
519+ # check pubkeys table
520+ res = self .get_table_schema ("pubkeys" )
521+ check = [['address' , 'text' ],
522+ ['addressversion' , 'int' ],
523+ ['transmitdata' , 'blob' ],
524+ ['time' , 'int' ],
525+ ['usedpersonally' , 'text' ]]
526+ self .assertEqual (res , check , "pubkeys table not valid" )
527+
528+ # check inventory table
529+ res = self .get_table_schema ("inventory" )
530+ check = [['hash' , 'blob' ],
531+ ['objecttype' , 'int' ],
532+ ['streamnumber' , 'int' ],
533+ ['payload' , 'blob' ],
534+ ['expirestime' , 'integer' ],
535+ ['tag' , 'blob' ]]
536+ self .assertEqual (res , check , "inventory table not valid" )
537+
538+ # check settings table
539+ res = self .get_table_schema ("settings" )
540+ check = [['key' , 'blob' ],
541+ ['value' , 'blob' ]]
542+ self .assertEqual (res , check , "settings table not valid" )
543+
544+ # check objectprocessorqueue table
545+ res = self .get_table_schema ("objectprocessorqueue" )
546+ check = [['objecttype' , 'int' ],
547+ ['data' , 'blob' ]]
548+ self .assertEqual (res , check , "objectprocessorqueue table not valid" )
0 commit comments