Exemplo n.º 1
0
class TestUser(TestCase):
    def setUp(self):
        self.user = User('foo', 'bar')

    def test_set_user(self):
        self.user.set_user()
        self.assertEqual('foo', self.user.user_name)

    def test_set_pwd(self):
        self.user.set_pwd()
        self.assertEqual('bar', self.user.user_pwd)
Exemplo n.º 2
0
def main():
    """
    Main entry point for the FunPDBe client
    :return: None
    """

    logger = FunPDBeClientLogger(name="main", write_mode="w")

    try:
        opts, args = getopt.getopt(sys.argv[1:], "u:p:m:i:r:f:a:oh", [
            "user="******"pwd=", "mode=", "pdb_id=", "resource=", "path=", "api=",
            "overwrite", "help"
        ])
    except getopt.GetoptError as err:
        generic_error()
        logger.log().error(err)
        sys.exit(2)

    schema = Schema()
    user = User()
    client = Client(schema, user)
    if opts:
        Control(opts, client=client).run()
    else:
        Control([('--help', '')], client=client).run()
Exemplo n.º 3
0
 def initialize_user(self):
     """
     Create User() instance based on
     user name and password
     :return: new User()
     """
     return User(user=self.user, pwd=self.pwd)
Exemplo n.º 4
0
class TestUser(TestCase):
    def setUp(self):
        self.user = User('foo', 'bar')

    def test_set_user(self):
        self.user.set_user()
        self.assertEqual('foo', self.user.user_name)

    def test_set_pwd(self):
        self.user.set_pwd()
        self.assertEqual('bar', self.user.user_pwd)

    def test_set_attribute(self):
        with patch('builtins.input', side_effect='f'):
            new_value = self.user.set_attribute(None, 'user prompt message')
        self.assertEqual('f', new_value)
Exemplo n.º 5
0
 def setUp(self):
     self.user = User('foo', 'bar')