Exemple #1
0
    def localdb_test(self):
        tmp_dir = temp_folder()
        db_file = os.path.join(tmp_dir, "dbfile")
        localdb = LocalDB(db_file)

        # Test write and read login
        localdb.init()
        login, token = localdb.get_login()
        self.assertIsNone(login)
        self.assertIsNone(token)

        localdb.set_login(("pepe", "token"))
        login, token = localdb.get_login()
        self.assertEquals("pepe", login)
        self.assertEquals("token", token)
        self.assertEquals("pepe", localdb.get_username())
Exemple #2
0
    def localdb_test(self):
        tmp_dir = temp_folder()
        db_file = os.path.join(tmp_dir, "dbfile")
        localdb = LocalDB(db_file)

        # Test write and read login
        localdb.init()
        user, token = localdb.get_login("myurl1")
        self.assertIsNone(user)
        self.assertIsNone(token)

        localdb.set_login(("pepe", "token"), "myurl1")
        user, token = localdb.get_login("myurl1")
        self.assertEquals("pepe", user)
        self.assertEquals("token", token)
        self.assertEquals("pepe", localdb.get_username("myurl1"))
Exemple #3
0
def users_list(localdb_file, remotes):
    if not remotes:
        raise ConanException("No remotes defined")

    localdb = LocalDB(localdb_file)
    remotes_info = []
    for remote in remotes:
        user_info = {}
        user, token = localdb.get_login(remote.url)
        user_info["name"] = remote.name
        user_info["user_name"] = user
        user_info["authenticated"] = True if token else False
        remotes_info.append(user_info)
    return remotes_info