# -*- coding: utf-8 -*-
import unittest
import solvebio
import solvebio.cli.auth as auth


def bad_creds(login=None):
    return 'rocky@foo.bar', 'weird'


def fake_delete_credentials():
    return


class TestLogin(unittest.TestCase):
    def setUp(self):
        self.api_host = solvebio.api_host
        self._ask_for_credentials = auth._ask_for_credentials
        self.delete_credentials = auth.delete_credentials

        auth._ask_for_credentials = lambda login=None: ('fake@foo.bar',
                                                        'p4ssw0rd')
        auth.delete_credentials = lambda: None

    def tearDown(self):
        solvebio.api_host = self.api_host
        auth._ask_for_credentials = self._ask_for_credentials
        auth.delete_credentials = self.delete_credentials

    def test_bad_login(self):
        self.assertEqual(auth.login('foo'), False, "Invalid login")

        # Test invalid host
        solvebio.api_host = 'https://some.fake.domain.foobar'
        self.assertEqual(auth.login('foo'), False,
                         "Invalid login")

@@ -88,117 +88,8 @@
 h%0A%0A%0A
-def bad_creds(login=None):%0A    return 'rocky@foo.bar', 'weird'%0A%0A%0Adef fake_delete_credentials():%0A    return%0A%0A%0A
 clas
@@ -175,32 +175,93 @@
 lvebio.api_host%0A
+        # temporarily replace with dummy methods for testing%0A
         self._as
@@ -298,32 +298,32 @@
 for_credentials%0A
+
         self.del
@@ -360,25 +360,24 @@
 credentials%0A
-%0A
         auth

remove unused methods in test_login