Move constants from ParserTest to TestBase
This commit is contained in:
parent
57acc6ecb5
commit
fa12a6f046
3 changed files with 9 additions and 17 deletions
|
|
@ -216,10 +216,7 @@ class PasswordTest: XCTestCase {
|
|||
}
|
||||
|
||||
func testEmptyMultilineValues() {
|
||||
let lineBreakField1 = "with line breaks" => "| \n"
|
||||
let lineBreakField2 = "with line breaks" => "| \n "
|
||||
let noLineBreakField = "without line breaks" => " > "
|
||||
let additions = lineBreakField1 | lineBreakField2 | NOTE_FIELD | noLineBreakField
|
||||
let additions = MULTILINE_BLOCK_START | "\n" | MULTILINE_BLOCK_START | " \n" | NOTE_FIELD | MULTILINE_LINE_START
|
||||
let fileContent = PASSWORD_STRING | additions
|
||||
let password = getPasswordObjectWith(content: fileContent)
|
||||
|
||||
|
|
@ -227,10 +224,10 @@ class PasswordTest: XCTestCase {
|
|||
XCTAssertEqual(password.plainData, fileContent.data(using: .utf8))
|
||||
XCTAssertEqual(password.additionsPlainText, additions)
|
||||
|
||||
XCTAssertTrue(does(password, contain: lineBreakField1.title => ""))
|
||||
XCTAssertTrue(does(password, contain: lineBreakField2.title => ""))
|
||||
XCTAssertTrue(does(password, contain: MULTILINE_BLOCK_START.title => ""))
|
||||
XCTAssertTrue(does(password, contain: MULTILINE_BLOCK_START.title => ""))
|
||||
XCTAssertTrue(does(password, contain: NOTE_FIELD))
|
||||
XCTAssertTrue(does(password, contain: noLineBreakField.title => ""))
|
||||
XCTAssertTrue(does(password, contain: MULTILINE_LINE_START.title => ""))
|
||||
}
|
||||
|
||||
func testMultilineValues() {
|
||||
|
|
|
|||
|
|
@ -11,15 +11,6 @@ import XCTest
|
|||
|
||||
class ParserTest: XCTestCase {
|
||||
|
||||
private let FIELD = "key" => "value"
|
||||
private let LOGIN_FIELD = "login" => "login name"
|
||||
private let SECURE_URL_FIELD = "url" => "https://secure.com"
|
||||
private let INSECURE_URL_FIELD = "url" => "http://insecure.com"
|
||||
private let USERNAME_FIELD = "username" => "微 分 方 程"
|
||||
private let NOTE_FIELD = "note" => "A NOTE"
|
||||
private let MULTILINE_BLOCK_START = "multiline block" => "|"
|
||||
private let MULTILINE_LINE_START = "multiline line" => ">"
|
||||
|
||||
func testInit() {
|
||||
[
|
||||
("", "", "", []),
|
||||
|
|
|
|||
|
|
@ -16,14 +16,18 @@ let PASSWORD_STRING = "abcd1234"
|
|||
let TOTP_URL = "otpauth://totp/email@email.com?secret=abcd1234"
|
||||
let HOTP_URL = "otpauth://hotp/email@email.com?secret=abcd1234"
|
||||
|
||||
let FIELD = "key" => "value"
|
||||
let SECURE_URL_FIELD = "url" => "https://secure.com"
|
||||
let INSECURE_URL_FIELD = "url" => "http://insecure.com"
|
||||
let LOGIN_FIELD = "login" => "login name"
|
||||
let USERNAME_FIELD = "username" => "some username"
|
||||
let USERNAME_FIELD = "username" => "微 分 方 程"
|
||||
let NOTE_FIELD = "note" => "A NOTE"
|
||||
let HINT_FIELD = "some hints" => "äöüß // €³ %% −° && @²` | [{\\}],.<>"
|
||||
let TOTP_URL_FIELD = "otpauth" => "//totp/email@email.com?secret=abcd1234"
|
||||
|
||||
let MULTILINE_BLOCK_START = "multiline block" => "|"
|
||||
let MULTILINE_LINE_START = "multiline line" => ">"
|
||||
|
||||
func getPasswordObjectWith(content: String, url: URL? = nil) -> Password {
|
||||
return Password(name: "password", url: url ?? PASSWORD_URL, plainText: content)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue