Example #1
0
    def test_migrate(self):
        with mock.patch.object(settings, 'INAPP_KEY_PATHS',
                {'2012-05-10': resource('inapp-sample-pay.key')}):
            cfg = create_inapp_config()
            old_key = cfg.get_private_key()
            old_raw_key = cfg._encrypted_private_key
            cfg = InappConfig.uncached.get(pk=cfg.pk)
            eq_(cfg.key_timestamp, '2012-05-10')

        with mock.patch.object(settings, 'INAPP_KEY_PATHS',
                {'2012-05-10': resource('inapp-sample-pay.key'),
                 '2012-05-11': resource('inapp-sample-pay-alt.key')}):
            Command().handle(old_timestamp='2012-05-10',
                             new_timestamp='2012-05-11')
            cfg = InappConfig.uncached.get(pk=cfg.pk)
            eq_(cfg.get_private_key(), old_key)
            new_raw_key = cfg._encrypted_private_key
            assert new_raw_key != old_raw_key, ('raw keys were changed')
            eq_(cfg.key_timestamp, '2012-05-11')
Example #2
0
 def test_empty_key_paths(self):
     Command().handle(old_timestamp='2012-05-10',
                      new_timestamp='2012-05-11')
Example #3
0
 def test_missing_new(self):
     Command().handle(old_timestamp='2012-05-10')
Example #4
0
 def test_missing_old(self):
     Command().handle(new_timestamp='2012-05-10')