Ejemplo n.º 1
0
 def test_it_prompts_migrations(self, tmpdir):
     with patch('yoyo.scripts.migrate.read_migrations') as read_migrations:
         with patch('yoyo.scripts.migrate.prompt_migrations') \
                 as prompt_migrations:
             main(['apply', tmpdir, dburi])
             migrations = read_migrations().to_apply()
             assert migrations in prompt_migrations.call_args[0]
Ejemplo n.º 2
0
 def test_it_prompts_migrations(self, tmpdir):
     with patch('yoyo.scripts.migrate.read_migrations') as read_migrations:
         with patch('yoyo.scripts.migrate.prompt_migrations') \
                 as prompt_migrations:
             main(['apply', tmpdir, dburi])
             migrations = read_migrations().to_apply()
             assert migrations in prompt_migrations.call_args[0]
Ejemplo n.º 3
0
 def test_it_reapplies_migrations(self, tmpdir):
     with patch('yoyo.scripts.migrate.read_migrations') as read_migrations:
         main(['-b', 'reapply', tmpdir, dburi])
         migrations = read_migrations().to_rollback()
         assert migrations.rollback.call_count == 1
         assert migrations.apply.call_count == 1
Ejemplo n.º 4
0
 def test_it_caches_connection_params(self, tmpdir):
     self.prompt.return_value = 'y'
     main(['apply', tmpdir, dburi])
     assert os.path.exists(os.path.join(tmpdir, '.yoyo-migrate'))
     with open(os.path.join(tmpdir, '.yoyo-migrate')) as f:
         assert 'dburi = {0}'.format(dburi) in f.read()
Ejemplo n.º 5
0
 def test_it_prompts_to_cache_connection_params(self, tmpdir):
     main(['apply', tmpdir, dburi])
     assert 'save connection string' in self.prompt.call_args[0][0].lower()
Ejemplo n.º 6
0
 def test_it_sets_verbosity_level(self, tmpdir):
     with patch('yoyo.scripts.migrate.configure_logging') as m:
         main(['apply', tmpdir, dburi])
         assert m.call_args == call(0)
         main(['-vvv', 'apply', tmpdir, dburi])
         assert m.call_args == call(3)
Ejemplo n.º 7
0
 def test_it_reapplies_migrations(self, tmpdir):
     with patch('yoyo.scripts.migrate.read_migrations') as read_migrations:
         main(['-b', 'reapply', tmpdir, dburi])
         migrations = read_migrations().to_rollback()
         assert migrations.rollback.call_count == 1
         assert migrations.apply.call_count == 1
Ejemplo n.º 8
0
 def test_it_caches_connection_params(self, tmpdir):
     self.prompt.return_value = 'y'
     main(['apply', tmpdir, dburi])
     assert os.path.exists(os.path.join(tmpdir, '.yoyo-migrate'))
     with open(os.path.join(tmpdir, '.yoyo-migrate')) as f:
         assert 'dburi = {0}'.format(dburi) in f.read()
Ejemplo n.º 9
0
 def test_it_prompts_to_cache_connection_params(self, tmpdir):
     main(['apply', tmpdir, dburi])
     assert 'save connection string' in self.prompt.call_args[0][0].lower()
Ejemplo n.º 10
0
 def test_it_sets_verbosity_level(self, tmpdir):
     with patch('yoyo.scripts.migrate.configure_logging') as m:
         main(['apply', tmpdir, dburi])
         assert m.call_args == call(0)
         main(['-vvv', 'apply', tmpdir, dburi])
         assert m.call_args == call(3)