def test_client_for_non_existing_user(self): fake_non_existing_user = self.fake_object fake_user = mock.MagicMock() javelin.USERS = {fake_user['name']: fake_user} self.useFixture(mockpatch.PatchObject(javelin, "OSClient")) javelin.client_for_user(fake_non_existing_user['name']) self.assertFalse(javelin.OSClient.called)
def test_client_for_user(self): fake_user = mock.MagicMock() javelin.USERS = {fake_user['name']: fake_user} self.useFixture(mockpatch.PatchObject(javelin, "OSClient")) javelin.client_for_user(fake_user['name']) javelin.OSClient.assert_called_once_with( fake_user['name'], fake_user['pass'], fake_user['tenant'])