def test_pulp_login(self, mocked_pulp, debug, cert, key, error): bopts = testbOpts("testserv", "testconf", debug, cert, key) p = testPulp() mocked_pulp.side_effect = [p] if debug: flexmock(testPulp) (testPulp .should_receive('setDebug') .once() .and_return(None)) flexmock(os.path) if error and not (key or cert): (os.path .should_receive('exists') .once() .and_return(False)) with pytest.raises(SystemExit): cli.pulp_login(bopts) return elif not cert or not key: (os.path .should_receive('exists') .twice() .and_return(True)) assert cli.pulp_login(bopts) is p
def test_pulp_login(self, debug, cert, key, error): bopts = testbOpts("testserv", "testconf", debug, cert, key) p = testPulp() (flexmock(Pulp) .new_instances(p) .with_args(Pulp, env=bopts.server, config_file=bopts.config_file)) if debug: flexmock(testPulp) (testPulp .should_receive('setDebug') .once() .and_return(None)) flexmock(os.path) if error and not (key or cert): (os.path .should_receive('exists') .once() .and_return(False)) with pytest.raises(SystemExit): cli.pulp_login(bopts) return elif not cert or not key: (os.path .should_receive('exists') .twice() .and_return(True)) assert cli.pulp_login(bopts) is p
def test_pulp_login(self, mocked_pulp, debug, cert, key, error): bopts = testbOpts("testserv", "testconf", debug, cert, key) p = testPulp() mocked_pulp.side_effect = [p] if debug: flexmock(testPulp) (testPulp.should_receive('setDebug').once().and_return(None)) flexmock(os.path) if error and not (key or cert): (os.path.should_receive('exists').once().and_return(False)) with pytest.raises(SystemExit): cli.pulp_login(bopts) return elif not cert or not key: (os.path.should_receive('exists').twice().and_return(True)) assert cli.pulp_login(bopts) is p
def test_pulp_login(self, debug, cert, key, error): bopts = testbOpts("testserv", "testconf", debug, cert, key) p = testPulp() (flexmock(Pulp).new_instances(p).with_args( Pulp, env=bopts.server, config_file=bopts.config_file)) if debug: flexmock(testPulp) (testPulp.should_receive('setDebug').once().and_return(None)) flexmock(os.path) if error and not (key or cert): (os.path.should_receive('exists').once().and_return(False)) with pytest.raises(SystemExit): cli.pulp_login(bopts) return elif not cert or not key: (os.path.should_receive('exists').twice().and_return(True)) assert cli.pulp_login(bopts) is p