def test_add_expires_option(self): options = pwsafecli.parse_commandline(self.parsers, ["unittest", "add", "--file", "foo", "--title", "blah", "--username", "me", "--group", "foo.bar.baz", "--password", "secret", "--expires", "2012-01-01 00:00"]) pwsafecli.add_validator(options) with AssertRaises(pwsafecli.PWSafeCLIValidationError) as cm: options = pwsafecli.parse_commandline(self.parsers, ["unittest", "add", "--file", "foo", "--title", "blah", "--username", "me", "--group", "foo.bar.baz", "--password", "secret", "--expires", "2012-01-01 00:00:00 MDT"])
def test_get_display_option(self): options = pwsafecli.parse_commandline(self.parsers, "unittest get --file foo --uuid f2dee5f8-e964-402f-9fe7-78bd2b5cba2e --display username,password".split()) pwsafecli.get_validator(options) options = pwsafecli.parse_commandline(self.parsers, "unittest get --file foo --uuid f2dee5f8-e964-402f-9fe7-78bd2b5cba2e --display username,password,uuid".split()) pwsafecli.get_validator(options) options = pwsafecli.parse_commandline(self.parsers, "unittest get --file foo --uuid f2dee5f8-e964-402f-9fe7-78bd2b5cba2e --display username,password,uuid,missing".split()) with AssertRaises(pwsafecli.PWSafeCLIValidationError) as cm: pwsafecli.get_validator(options)
def test_add_expires_option(self): options = pwsafecli.parse_commandline(self.parsers, [ "unittest", "add", "--file", "foo", "--title", "blah", "--username", "me", "--group", "foo.bar.baz", "--password", "secret", "--expires", "2012-01-01 00:00" ]) pwsafecli.add_validator(options) with AssertRaises(pwsafecli.PWSafeCLIValidationError) as cm: options = pwsafecli.parse_commandline(self.parsers, [ "unittest", "add", "--file", "foo", "--title", "blah", "--username", "me", "--group", "foo.bar.baz", "--password", "secret", "--expires", "2012-01-01 00:00:00 MDT" ])
def test_add_missing_password(self): options = pwsafecli.parse_commandline( self.parsers, "unittest add --file foo --title blah --username me --group foo.bar.baz" .split()) with AssertRaises(pwsafecli.PWSafeCLIValidationError) as cm: pwsafecli.add_validator(options)
def test_get_missing_options(self): for cmdline in ("unittest get --file foo", "unittest get --file foo --email foo@bar"): print cmdline options = pwsafecli.parse_commandline(self.parsers, cmdline.split()) with AssertRaises(pwsafecli.PWSafeCLIValidationError): pwsafecli.get_validator(options)
def test_get_missing_options(self): for cmdline in ("unittest get --file foo", "unittest get --file foo --email foo@bar"): print(cmdline) options = pwsafecli.parse_commandline(self.parsers, cmdline.split()) with AssertRaises(pwsafecli.PWSafeCLIValidationError): pwsafecli.get_validator(options)
def test_get_display_option(self): options = pwsafecli.parse_commandline( self.parsers, "unittest get --file foo --uuid f2dee5f8-e964-402f-9fe7-78bd2b5cba2e --display username,password" .split()) pwsafecli.get_validator(options) options = pwsafecli.parse_commandline( self.parsers, "unittest get --file foo --uuid f2dee5f8-e964-402f-9fe7-78bd2b5cba2e --display username,password,uuid" .split()) pwsafecli.get_validator(options) options = pwsafecli.parse_commandline( self.parsers, "unittest get --file foo --uuid f2dee5f8-e964-402f-9fe7-78bd2b5cba2e --display username,password,uuid,missing" .split()) with AssertRaises(pwsafecli.PWSafeCLIValidationError) as cm: pwsafecli.get_validator(options)
def test_add_filename_no_options(self): options = pwsafecli.parse_commandline( self.parsers, "unittest add --file foo".split()) with AssertRaises(pwsafecli.PWSafeCLIValidationError) as cm: pwsafecli.add_validator(options)
def test_no_action_help(self): with AssertRaises(pwsafecli.PWSafeCLIValidationError) as cm: pwsafecli.parse_commandline(self.parsers, "unittest --help".split())
def test_update_missing_uuid(self): options = pwsafecli.parse_commandline( self.parsers, "unittest update --file foo --username test".split()) with AssertRaises(pwsafecli.PWSafeCLIValidationError) as cm: pwsafecli.update_validator(options)
def test_add_no_options(self): with AssertRaises(SystemExit) as cm: options = pwsafecli.parse_commandline(self.parsers, "unittest add".split())
def test_unknown_command(self): with AssertRaises(pwsafecli.PWSafeCLIValidationError) as cm: pwsafecli.parse_commandline(self.parsers, "unittest unknown".split())
def test_no_action(self): with AssertRaises(pwsafecli.PWSafeCLIValidationError) as cm: pwsafecli.parse_commandline(self.parsers, ['unittest',])
def test_update_missing_uuid(self): options = pwsafecli.parse_commandline(self.parsers, "unittest update --file foo --username test".split()) with AssertRaises(pwsafecli.PWSafeCLIValidationError) as cm: pwsafecli.update_validator(options)
def test_init_options(self): options = pwsafecli.parse_commandline(self.parsers, "unittest init --file foo".split()) pwsafecli.init_validator(options)
def test_init_options(self): options = pwsafecli.parse_commandline( self.parsers, "unittest init --file foo".split()) pwsafecli.init_validator(options)
def test_add_filename_no_options(self): options = pwsafecli.parse_commandline(self.parsers, "unittest add --file foo".split()) with AssertRaises(pwsafecli.PWSafeCLIValidationError) as cm: pwsafecli.add_validator(options)
def test_no_action(self): with AssertRaises(pwsafecli.PWSafeCLIValidationError) as cm: pwsafecli.parse_commandline(self.parsers, [ 'unittest', ])
def test_add_missing_password(self): options = pwsafecli.parse_commandline(self.parsers, "unittest add --file foo --title blah --username me --group foo.bar.baz".split()) with AssertRaises(pwsafecli.PWSafeCLIValidationError) as cm: pwsafecli.add_validator(options)
def test_unknown(self): with AssertRaises(pwsafecli.PWSafeCLIValidationError) as cm: pwsafecli.parse_commandline(self.parsers, "unittest --what".split())