Commits

mdelagra committed bae7f96

added test for placing passwords in the hgrc

Comments (0)

Files changed (2)

mercurial_reviewboard/tests/__init__.py

                     return None
                 elif args[1] == 'target_people':
                     return None
+                elif args[1] == 'user':
+                    return 'foo'
+                elif args[1] == 'password':
+                    return 'bar'
             raise Exception("unknown args: %s" % args.__str__())
         config_mock = Mock()
         config_mock.side_effect = config_side_effect

mercurial_reviewboard/tests/test_getreviewboard.py

+from mock import patch
+
+from mercurial_reviewboard import getreviewboard
+from mercurial_reviewboard.tests import mock_ui
+
+@patch('mercurial_reviewboard.ReviewBoard')
+def test_get_credentials_from_config(mock_reviewboard):
+        
+    # username and password configs are included 
+    # in the mock
+    ui = mock_ui()
+        
+    getreviewboard(ui)
+    
+    mock_reviewboard.return_value.login.assert_called_with('foo', 'bar')
+
+