Skip to content

Commit

Permalink
Merge pull request #16 from crccheck/mysqladmin-support
Browse files Browse the repository at this point in the history
update for better support for 'mysqladmin' command
  • Loading branch information
crccheck committed Jan 6, 2015
2 parents cadf8fb + a9ac304 commit d2b6b13
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
3 changes: 3 additions & 0 deletions postdoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ def get_command(command, meta):
# connection params
bits.extend(connect_bits(meta))
# database name
if command == 'mysqladmin':
# these commands shouldn't take a database name
return bits
if command == 'pg_restore':
bits.append('--dbname')
if command == 'mysql':
Expand Down
11 changes: 11 additions & 0 deletions test_postdoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,17 @@ def test_get_command_ignores_password(self):
self.assertEqual(postdoc.get_command('bar', meta),
['bar', 'rofl', 'database'])

def test_get_commands_can_ignore_database_name(self):
meta = type('mock', (object, ),
{'scheme': 'mysql', 'username': 'u', 'hostname': 'h', 'port': '',
'password': 'oops', 'path': '/database'})
result = postdoc.get_command('mysqladmin', meta)
# assert database name is not an argument
self.assertNotIn('database', result)
# sanity check the connect args are still passed
self.assertEqual(result,
['mysqladmin', '-u', 'u', '-poops', '-h', 'h'])

def test_get_command_special_syntax_for_pg_restore(self):
meta = type('mock', (object, ),
{'username': '', 'hostname': '', 'port': '', 'password': 'oops',
Expand Down

0 comments on commit d2b6b13

Please sign in to comment.