Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
enzevalos_iphone
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
enzevalos
enzevalos_iphone
Commits
9f9dbb52
Commit
9f9dbb52
authored
5 years ago
by
Viktoria
Browse files
Options
Downloads
Patches
Plain Diff
wip
parent
c680c827
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
enzevalos_iphoneTests/GeneratedMocks.swift
+2
-2
2 additions, 2 deletions
enzevalos_iphoneTests/GeneratedMocks.swift
enzevalos_iphoneTests/phishing/MailComparisonTests.swift
+20
-8
20 additions, 8 deletions
enzevalos_iphoneTests/phishing/MailComparisonTests.swift
with
22 additions
and
10 deletions
enzevalos_iphoneTests/GeneratedMocks.swift
+
2
−
2
View file @
9f9dbb52
// MARK: - Mocks generated from file: enzevalos_iphone/AuthenticationModel.swift at 2020-03-26 1
2
:4
7:18
+0000
// MARK: - Mocks generated from file: enzevalos_iphone/AuthenticationModel.swift at 2020-03-26 1
5
:4
1:47
+0000
//
// AuthenticationModel.swift
...
...
@@ -653,7 +653,7 @@ import Foundation
}
// MARK: - Mocks generated from file: enzevalos_iphone/AuthenticationViewModel.swift at 2020-03-26 1
2
:4
7:18
+0000
// MARK: - Mocks generated from file: enzevalos_iphone/AuthenticationViewModel.swift at 2020-03-26 1
5
:4
1:47
+0000
//
// AuthenticationViewModel.swift
...
...
This diff is collapsed.
Click to expand it.
enzevalos_iphoneTests/phishing/MailComparisonTests.swift
+
20
−
8
View file @
9f9dbb52
//
import
XCTest
import
Contacts
@testable
import
enzevalos_iphone
class
MailComparisonTests
:
XCTestCase
{
let
datahandler
=
DataHandler
.
handler
...
...
@@ -44,15 +45,23 @@ class MailComparisonTests: XCTestCase {
/**************
Code
******************/
@NSManaged
public
var
c
ontact
:
EnzevalosContact
@NSManaged
public
var
eC
ontact
:
EnzevalosContact
public
func
compareSenderToContacts
(
_
mail
:
PersistentMail
?
)
->
String
{
let
senderAddress
=
mail
?
.
from
.
mailAddress
// 1. ich will wissen, ob der sender bekannt ist, deshalb erst einmal equal test mit sender und kontaktbuch durch cncontact
let
contacts
=
datahandler
.
getContacts
()
let
enzContacts
=
datahandler
.
getContacts
()
for
contact
in
enzContacts
{
if
contact
.
isAddress
(
mailadr
:
senderAddress
!
){
return
"is a contact"
}
/*
for cont in contacts{
let
addr
=
mail
?
.
from
.
contact
?
.
cnContact
let addr = mail?.from.contact?.cnContact
?.getMailAddresses()
if addr != nil{
return "is a contact"
}
...
...
@@ -60,14 +69,15 @@ class MailComparisonTests: XCTestCase {
return "send mails before"
}
}
// 2. ich will wissen, ob der sender schon eine mail geschickt hat, wenn nicht im kontaktbuch, deshalb vergleich mit contact
let knownMailAddresses = contact.getMailAddresses()
for knownAddress in knownMailAddresses{
if
knownAddress
.
mailAddress
==
senderAddress
{
if knownAddress.mailAddress == senderAddress
!
{
return "has alrady send an email"
}
*/
}
/*
if mail?.from.contact?.getMailAddresses() == senderAddress{
...
...
@@ -81,7 +91,9 @@ class MailComparisonTests: XCTestCase {
End Code
****************/
func
createAddressBook
(){
let
_
=
datahandler
.
getContactByMCOAddress
(
address
:
user
)
datahandler
.
reset
()
_
=
datahandler
.
getContactByMCOAddress
(
address
:
user
)
datahandler
.
save
(
during
:
"createAddressBook"
)
}
func
testCompareSenderToContacts
()
{
...
...
@@ -91,8 +103,8 @@ class MailComparisonTests: XCTestCase {
let
mail_3
=
testMail
(
from
:
user_2
,
to
:
[],
cc
:
[],
bcc
:
[])
let
mail_4
=
testMail
(
from
:
user_2
,
to
:
[],
cc
:
[],
bcc
:
[])
let
mailsInInbox
:
[
PersistentMail
]
=
[
mail_1
!
,
mail_2
!
,
mail_3
!
,
mail_4
!
]
XCTAssertEqual
(
"is a contact"
,
compareSenderToContacts
(
mail
_1
))
//
XCTAssertEqual("
send mails befor
e", compareSenderToContacts(mail
_2
))
XCTAssertEqual
(
"is a contact"
,
compareSenderToContacts
(
mail
sInInbox
[
0
]
))
XCTAssertEqual
(
"
fals
e"
,
compareSenderToContacts
(
mail
sInInbox
[
1
]
))
// XCTAssertEqual("has alrady send an email", compareSenderToContacts(mailsInInbox[2]))
// XCTAssertEqual("false", compareSenderToContacts(mail_2))
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment