Ejemplo n.º 1
0
    def test_replace_heroku_db_no_file_url(self, mock_check_call):
        command = Command(self.parser.parse_args(['-d', 'app2']))
        command.databases['source']['name'] = 'srcdb'

        command.replace_heroku_db(None)

        expected_calls = [call(['heroku', 'pg:reset', '--app=app2', 'DATABASE_URL']),
                          call(['heroku', 'pg:push', 'srcdb', 'DATABASE_URL', '--app=app2'])]
        self.assertEqual(expected_calls, mock_check_call.call_args_list)
Ejemplo n.º 2
0
    def test_replace_heroku_db_with_file_url(self, mock_check_call):
        command = Command(self.parser.parse_args(['-u', 'www.example.com', '-d', 'app2']))
        command.databases['source']['name'] = 'srcdb'

        command.replace_heroku_db('www.example.com')

        expected_calls = [call(['heroku', 'pg:reset', '--app=app2', 'DATABASE_URL']),
                          call(['heroku', 'pg:backups:restore', 'www.example.com', '--app=app2',
                                'DATABASE', '--confirm', 'app2'])]
        self.assertEqual(expected_calls, mock_check_call.call_args_list)