On 08.03.2013 [13:42:25 -0600], Julius Gawlas wrote: > set the username for rpc call based on --username passed > in command arguments, also added a unit test > > Signed-off-by: Julius Gawlas <[email protected]>
Acked-by: Nishanth Aravamudan <[email protected]> > --- > cli/topic_common.py | 1 + > cli/topic_common_unittest.py | 13 +++++++++++++ > 2 files changed, 14 insertions(+), 0 deletions(-) > > diff --git a/cli/topic_common.py b/cli/topic_common.py > index d792e1e..899b50b 100644 > --- a/cli/topic_common.py > +++ b/cli/topic_common.py > @@ -459,6 +459,7 @@ class atest(object): > > self.verbose = options.verbose > self.web_server = options.web_server > + self.username = options.username > try: > self.afe = rpc.afe_comm(self.web_server, username=self.username) > except rpc.AuthError, s: > diff --git a/cli/topic_common_unittest.py b/cli/topic_common_unittest.py > index c8f1f88..123412b 100755 > --- a/cli/topic_common_unittest.py > +++ b/cli/topic_common_unittest.py > @@ -769,6 +769,17 @@ class atest_unittest(cli_mock.cli_unittest): > 'debug': True}, options) > self.assertEqual(leftover, ['left1', 'left2']) > > + def test_parse_username(self): > + sys.argv = ['atest', '--username', '[email protected]'] > + (options, unused_leftover) = self.atest.parse() > + self.assertEqual({'username': '[email protected]', > + 'parse_delim': '|', > + 'kill_on_failure': False, > + 'verbose': False, > + 'web_server': None, > + 'parse': False, > + 'debug': False}, options) > + self.assertEqual('[email protected]', self.atest.afe.username) > > def test_execute_rpc_bad_server(self): > self.atest.afe = rpc.afe_comm('http://does_not_exist') > @@ -994,5 +1005,7 @@ class atest_unittest(cli_mock.cli_unittest): > 'Id=id1|Name=name1\n') > > > + > + > if __name__ == '__main__': > unittest.main() > -- > 1.7.7.6 > > _______________________________________________ > Autotest-kernel mailing list > [email protected] > https://www.redhat.com/mailman/listinfo/autotest-kernel > _______________________________________________ Autotest-kernel mailing list [email protected] https://www.redhat.com/mailman/listinfo/autotest-kernel
