예제 #1
0
    def setUpClass(cls):
        if not cls.server:
            cls.server = TestServerLauncher(
                server_capabilities=['ImCool', 'TooCool'])
            cls.server.start()

            filename = os.path.join(temp_folder(), "conan.conf")
            save(filename, "")
            config = ConanClientConfigParser(filename)
            requester = ConanRequester(config, requests)
            client_factory = RestApiClientFactory(TestBufferConanOutput(),
                                                  requester=requester,
                                                  config=config)
            localdb = LocalDBMock()

            mocked_user_io = UserIO(out=TestBufferConanOutput())
            mocked_user_io.get_username = Mock(return_value="private_user")
            mocked_user_io.get_password = Mock(return_value="private_pass")

            cls.auth_manager = ConanApiAuthManager(client_factory,
                                                   mocked_user_io, localdb)
            cls.remote = Remote("myremote",
                                "http://127.0.0.1:%s" % str(cls.server.port),
                                True, True)
            cls.auth_manager._authenticate(cls.remote,
                                           user="******",
                                           password="******")
            cls.api = client_factory.new(cls.remote, localdb.access_token,
                                         localdb.refresh_token, {})
예제 #2
0
    def setUp(self):
        mocked_user_io = UserIO(out=TestBufferConanOutput())
        mocked_user_io.get_username = Mock(return_value="myuser")
        mocked_user_io.get_password = Mock(return_value="mypassword")

        requester = RequesterWithTokenMock()
        config = namedtuple("ConfigMock", "revisions_enabled download_cache")(False, None)
        self.rest_client_factory = RestApiClientFactory(mocked_user_io.out,
                                                        requester, config=config,
                                                        artifacts_properties=None)
        self.localdb = LocalDBMock()
        self.auth_manager = ConanApiAuthManager(self.rest_client_factory, mocked_user_io,
                                                self.localdb)
        self.remote = Remote("myremote", "myurl", True, True)
        self.ref = ConanFileReference.loads("lib/1.0@conan/stable")