Changes between Version 2 and Version 3 of Ticket #6517, comment 14


Ignore:
Timestamp:
Oct 12, 2020, 9:05:20 PM (4 years ago)
Author:
Manav Agarwal

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #6517, comment 14

    v2 v3  
     1I wrote a test which is as follows:
    12
    23{{{
    3    def test_charset_configured(self):
    4         self.assertEqual(
    5             ['mysql', '--user=someuser', '--password=somepassword',
    6              '--host=somehost', '--port=444', 'default-character-set=utf8', 'somedbname'],
    7             self.get_command_line_arguments({
    8                 'NAME': 'somedbname',
    9                 'USER': 'someuser',
    10                 'PASSWORD': 'somepassword',
    11                 'HOST': 'somehost',
    12                 'PORT': 444,
    13                 'DEFAULT-CHARACTER-SET' : 'utf8',
    14             }))
     4def test_charset_configured(self):
     5    self.assertEqual(
     6        ['mysql', '--user=someuser', '--password=somepassword',
     7         '--host=somehost', '--port=444', 'somedbname'],
     8        self.get_command_line_arguments({
     9            'NAME': 'somedbname',
     10            'USER': 'someuser',
     11            'PASSWORD': 'somepassword',
     12            'HOST': 'somehost',
     13            'PORT': 444,
     14            'DEFAULT-CHARACTER-SET': 'utf8',
     15            'OPTIONS': {},
     16        }))
     17}}}
     18So in the above-mentioned tests, it is working fine when I am not using --default-character-set=utf8 in the list while I am including the same in the dictionary. (The above test is working fine) but IMO it should not work fine as when we are explicitly defining default-character-set to utf8 in the settings file, then it is to be mentioned in the list but as soon as I am adding the same to the list it is raising an error which means it needs a patch and after applying the patch as follows:
     19{{{
    1520
     21charset = settings_dict['OPTIONS'].get('charset',settings_dict['DEFAULT-CHARACTER-SET'])
     22if charset:
     23    args += ["--default-character-set=%s" % charset]
    1624}}}
    17 Adding above mentioned function in {{{MySqlDbshellCommandTestCase}}} class of {{{tests/dbshell/test_mysql.py}}} would be a good test function?
    18 Please review the same so that I may create a PR.
     25The above test is getting failed and the below-mentioned test is getting successfully executed.
     26{{{
     27def test_charset_configured(self):
     28    self.assertEqual(
     29        ['mysql', '--user=someuser', '--password=somepassword',
     30         '--host=somehost', '--port=444', 'somedbname',  '--default-character-set=utf8'],
     31        self.get_command_line_arguments({
     32            'NAME': 'somedbname',
     33            'USER': 'someuser',
     34            'PASSWORD': 'somepassword',
     35            'HOST': 'somehost',
     36            'PORT': 444,
     37            'OPTIONS': {},
     38            'DEFAULT-CHARACTER-SET': 'utf8',
     39        }))
     40}}}
     41If the patch and the tests seem fine, I may create a PR
Back to Top