Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
enzevalos
enzevalos_iphone
Commits
10d1ce0f
Commit
10d1ce0f
authored
Apr 10, 2021
by
Oliver Wiese
Browse files
fix and clean test cases
parent
ce870728
Changes
6
Hide whitespace changes
Inline
Side-by-side
enzevalos_iphoneTests/CoreMailTest.swift
View file @
10d1ce0f
...
...
@@ -51,7 +51,7 @@ class CoreMailTest: XCTestCase {
func
testImportMail
(){
let
addr
=
"vic@example.com"
let
addr1
=
AddressProperties
(
email
:
addr
)
let
folder
=
FolderProperties
(
delimiter
:
nil
,
uidValidity
:
nil
,
lastUpdate
:
nil
,
maxUID
:
nil
,
minUID
:
nil
,
path
:
"Testfolder"
,
parent
:
nil
,
children
:
nil
)
let
folder
=
FolderProperties
(
delimiter
:
nil
,
uidValidity
:
nil
,
lastUpdate
:
nil
,
maxUID
:
nil
,
minUID
:
nil
,
path
:
"Testfolder"
,
parent
:
nil
,
children
:
nil
,
flags
:
0
)
let
importExpectation
=
expectation
(
description
:
"Import new msg!"
)
...
...
@@ -89,7 +89,7 @@ class CoreMailTest: XCTestCase {
func
testDuplicateMails
()
{
let
addr1
=
AddressProperties
(
email
:
"vic@example.com"
)
let
folder
=
FolderProperties
(
delimiter
:
nil
,
uidValidity
:
nil
,
lastUpdate
:
nil
,
maxUID
:
nil
,
minUID
:
nil
,
path
:
"Testfolder"
,
parent
:
nil
,
children
:
nil
)
let
folder
=
FolderProperties
(
delimiter
:
nil
,
uidValidity
:
nil
,
lastUpdate
:
nil
,
maxUID
:
nil
,
minUID
:
nil
,
path
:
"Testfolder"
,
parent
:
nil
,
children
:
nil
,
flags
:
0
)
let
m1
=
MailProperties
(
messageID
:
"1"
,
uid
:
UInt64
(
arc4random
()),
subject
:
"MSG1"
,
date
:
Date
(),
flags
:
0
,
from
:
addr1
,
folder
:
folder
,
signatureState
:
0
,
encryptionState
:
0
)
let
m2
=
MailProperties
(
messageID
:
"1"
,
uid
:
UInt64
(
arc4random
()),
subject
:
"Second MSG1"
,
date
:
Date
(),
flags
:
0
,
from
:
addr1
,
folder
:
folder
,
signatureState
:
0
,
encryptionState
:
0
)
...
...
@@ -121,7 +121,7 @@ class CoreMailTest: XCTestCase {
func
testDuplicateMails2
()
{
let
addr1
=
AddressProperties
(
email
:
"vic@example.com"
)
let
folder
=
FolderProperties
(
delimiter
:
nil
,
uidValidity
:
nil
,
lastUpdate
:
nil
,
maxUID
:
nil
,
minUID
:
nil
,
path
:
"Testfolder"
,
parent
:
nil
,
children
:
nil
)
let
folder
=
FolderProperties
(
delimiter
:
nil
,
uidValidity
:
nil
,
lastUpdate
:
nil
,
maxUID
:
nil
,
minUID
:
nil
,
path
:
"Testfolder"
,
parent
:
nil
,
children
:
nil
,
flags
:
0
)
let
m1
=
MailProperties
(
messageID
:
"1"
,
uid
:
UInt64
(
arc4random
()),
subject
:
"MSG1"
,
date
:
Date
(),
flags
:
0
,
from
:
addr1
,
folder
:
folder
,
signatureState
:
0
,
encryptionState
:
0
)
let
m2
=
MailProperties
(
messageID
:
"1"
,
uid
:
UInt64
(
arc4random
()),
subject
:
"Second MSG1"
,
date
:
Date
(),
flags
:
0
,
from
:
addr1
,
folder
:
folder
,
signatureState
:
0
,
encryptionState
:
0
)
...
...
@@ -171,7 +171,7 @@ class CoreMailTest: XCTestCase {
let
addr1
=
AddressProperties
(
email
:
"vic@example.com"
)
let
addr2
=
AddressProperties
(
email
:
"alex@example.com"
)
let
addrs
=
[
addr1
,
addr2
]
let
folder
=
FolderProperties
(
delimiter
:
nil
,
uidValidity
:
nil
,
lastUpdate
:
nil
,
maxUID
:
nil
,
minUID
:
nil
,
path
:
"Testfolder"
,
parent
:
nil
,
children
:
nil
)
let
folder
=
FolderProperties
(
delimiter
:
nil
,
uidValidity
:
nil
,
lastUpdate
:
nil
,
maxUID
:
nil
,
minUID
:
nil
,
path
:
"Testfolder"
,
parent
:
nil
,
children
:
nil
,
flags
:
0
)
var
msgs
=
[
MailProperties
]()
...
...
@@ -218,7 +218,7 @@ class CoreMailTest: XCTestCase {
let
addr1
=
AddressProperties
(
email
:
"vic@example.com"
)
let
addr2
=
AddressProperties
(
email
:
"alex@example.com"
)
let
addrs
=
[
addr1
,
addr2
]
let
folder
=
FolderProperties
(
delimiter
:
nil
,
uidValidity
:
nil
,
lastUpdate
:
nil
,
maxUID
:
nil
,
minUID
:
nil
,
path
:
"Testfolder"
,
parent
:
nil
,
children
:
nil
)
let
folder
=
FolderProperties
(
delimiter
:
nil
,
uidValidity
:
nil
,
lastUpdate
:
nil
,
maxUID
:
nil
,
minUID
:
nil
,
path
:
"Testfolder"
,
parent
:
nil
,
children
:
nil
,
flags
:
0
)
var
expectations
=
[
XCTestExpectation
]()
var
res
=
0
...
...
enzevalos_iphoneTests/CryptoTests.swift
View file @
10d1ce0f
...
...
@@ -533,7 +533,7 @@ class CryptoTests: XCTestCase {
func
testEncSignedMail
()
{
let
body
=
"signed text"
let
(
senderAddress
,
senderID
)
=
createPGPUser
()
let
(
userAddr
,
id2
)
=
createPGPUser
()
let
(
_
,
id2
)
=
createPGPUser
()
let
senderPGP
=
SwiftPGP
()
let
encObject
=
senderPGP
.
encrypt
(
plaintext
:
body
,
ids
:
[
userKeyID
],
myId
:
senderID
)
...
...
@@ -609,7 +609,7 @@ class CryptoTests: XCTestCase {
func
testMail
(
from
:
AddressProperties
,
to
:
[
AddressProperties
],
body
:
String
,
encState
:
EncryptionState
,
sigState
:
SignatureState
)
->
MailProperties
{
let
subject
=
"Test mail"
let
folder
=
FolderProperties
(
delimiter
:
nil
,
uidValidity
:
nil
,
lastUpdate
:
nil
,
maxUID
:
nil
,
minUID
:
nil
,
path
:
"Testfolder"
,
parent
:
nil
,
children
:
nil
)
let
folder
=
FolderProperties
(
delimiter
:
nil
,
uidValidity
:
nil
,
lastUpdate
:
nil
,
maxUID
:
nil
,
minUID
:
nil
,
path
:
"Testfolder"
,
parent
:
nil
,
children
:
nil
,
flags
:
0
)
let
mail
=
MailProperties
(
messageID
:
"dasdads"
,
uid
:
UInt64
(
arc4random
()),
subject
:
subject
,
date
:
Date
(),
flags
:
0
,
from
:
from
,
to
:
to
,
cc
:
[],
bcc
:
[],
folder
:
folder
,
body
:
body
,
attachments
:
[],
signatureState
:
sigState
.
rawValue
,
encryptionState
:
encState
.
rawValue
,
signatureKey
:
nil
,
decryptionKey
:
nil
,
autocryptHeaderKey
:
[],
attachedPublicKeys
:
[],
attachedSecretKeys
:
[])
...
...
enzevalos_iphoneTests/GeneratedMocks.swift
View file @
10d1ce0f
// MARK: - Mocks generated from file: enzevalos_iphone/AuthenticationModel.swift at 2021-04-
08 09:17:40
+0000
// MARK: - Mocks generated from file: enzevalos_iphone/AuthenticationModel.swift at 2021-04-
10 11:01:02
+0000
//
// AuthenticationModel.swift
...
...
@@ -654,7 +654,7 @@ import Foundation
}
// MARK: - Mocks generated from file: enzevalos_iphone/AuthenticationViewModel.swift at 2021-04-
08 09:17:40
+0000
// MARK: - Mocks generated from file: enzevalos_iphone/AuthenticationViewModel.swift at 2021-04-
10 11:01:02
+0000
//
// AuthenticationViewModel.swift
...
...
enzevalos_iphoneTests/MailTest.swift
View file @
10d1ce0f
...
...
@@ -115,7 +115,6 @@ n1O3czuVl7rPXrJn0A/MVI2ReKOQeIAYMg==
}
private
func
storeAndTestMail
(
mails
:
[
IncomingMail
],
testFunc
:
(
_
mail
:
MailRecord
)
->
())
{
let
oldmails
=
dataprovider
.
fetchedMailResultsController
.
fetchedObjects
?
.
count
??
0
let
importExpectation
=
expectation
(
description
:
"Import new email!"
)
dataprovider
.
importNewData
(
from
:
mails
.
map
({
$0
.
export
()}),
completionHandler
:
{
error
in
if
let
error
=
error
{
...
...
enzevalos_iphoneTests/SMIMETests.swift
View file @
10d1ce0f
...
...
@@ -433,8 +433,7 @@ PkfA6mR7rtcyIbHi34tfkCv/qolV3QivMHov0IJpRyNO
XCTFail
(
"Could not sign!"
)
}
//if let signedData = signObj?.chiphertext {
if
let
signedData
=
signObj
?
.
chiphertext
,
let
signedText
=
signObj
?
.
chiperString
{
if
let
_
=
signObj
?
.
chiphertext
,
let
signedText
=
signObj
?
.
chiperString
{
let
text
=
signedText
let
verifiedObj
=
smimeObj
.
verify
(
data
:
nil
,
string
:
text
,
email
:
ourAddr
!
,
isMailNew
:
true
)
...
...
enzevalos_iphoneTests/phishing/MailComparisonTests.swift
View file @
10d1ce0f
...
...
@@ -51,7 +51,7 @@ class MailComparisonTests: XCTestCase {
super
.
tearDown
()
}
func
testMail
(
from
:
AddressProperties
,
to
:
[
AddressProperties
],
cc
:
[
AddressProperties
],
bcc
:
[
AddressProperties
],
flags
:
MCOMessageFlag
=
MCOMessageFlag
.
init
(
rawValue
:
0
),
folder
:
FolderProperties
=
FolderProperties
(
delimiter
:
nil
,
uidValidity
:
nil
,
lastUpdate
:
nil
,
maxUID
:
nil
,
minUID
:
nil
,
path
:
"Inbox"
,
parent
:
nil
,
children
:
nil
),
date
:
Date
=
Date
(
timeIntervalSince1970
:
TimeInterval
(
arc4random
())),
cryptoObject
:
CryptoObject
?
=
nil
,
body
:
String
=
String
.
random
(
length
:
20
))
->
MailProperties
{
func
testMail
(
from
:
AddressProperties
,
to
:
[
AddressProperties
],
cc
:
[
AddressProperties
],
bcc
:
[
AddressProperties
],
flags
:
MCOMessageFlag
=
MCOMessageFlag
.
init
(
rawValue
:
0
),
folder
:
FolderProperties
=
FolderProperties
(
delimiter
:
nil
,
uidValidity
:
nil
,
lastUpdate
:
nil
,
maxUID
:
nil
,
minUID
:
nil
,
path
:
"Inbox"
,
parent
:
nil
,
children
:
nil
,
flags
:
0
),
date
:
Date
=
Date
(
timeIntervalSince1970
:
TimeInterval
(
arc4random
())),
cryptoObject
:
CryptoObject
?
=
nil
,
body
:
String
=
String
.
random
(
length
:
20
))
->
MailProperties
{
let
subject
=
String
.
random
(
length
:
20
)
let
id
=
UInt64
(
arc4random
())
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment