Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
SSHCreateKey
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mirrored_repos
AppleApps
rsyncOSX
SSHCreateKey
Commits
8a6e2d5a
Commit
8a6e2d5a
authored
8 months ago
by
Thomas Evensen
Browse files
Options
Downloads
Patches
Plain Diff
Update
parent
a8289c9f
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Tests/SSHCreateKeyTests/ReadTestdataFromGitHub.swift
+5
-2
5 additions, 2 deletions
Tests/SSHCreateKeyTests/ReadTestdataFromGitHub.swift
Tests/SSHCreateKeyTests/TestdataFromGitHub.swift
+7
-11
7 additions, 11 deletions
Tests/SSHCreateKeyTests/TestdataFromGitHub.swift
with
12 additions
and
13 deletions
Tests/SSHCreateKeyTests/ReadTestdataFromGitHub.swift
+
5
−
2
View file @
8a6e2d5a
...
@@ -9,12 +9,15 @@ import Foundation
...
@@ -9,12 +9,15 @@ import Foundation
final
class
ReadTestdataFromGitHub
{
final
class
ReadTestdataFromGitHub
{
var
testconfigurations
=
[
TestSynchronizeConfiguration
]()
var
testconfigurations
=
[
TestSynchronizeConfiguration
]()
private
var
urlJSONuiconfig
:
String
=
"https://raw.githubusercontent.com/rsyncOSX/RsyncArguments/master/Testdata/rsyncuiconfig.json"
private
var
urlJSON
:
String
=
"https://raw.githubusercontent.com/rsyncOSX/RsyncArguments/master/Testdata/configurations.json"
func
getdata
()
async
{
func
getdata
()
async
{
let
testdata
=
TestdataFromGitHub
()
let
testdata
=
TestdataFromGitHub
()
// Load user configuration
// Load user configuration
do
{
do
{
if
let
userconfig
=
try
await
testdata
.
getrsyncuiconfigbyURL
()
{
if
let
userconfig
=
try
await
testdata
.
loadanddecodestringdata
(
DecodeTestUserConfiguration
.
self
,
fromwhere
:
urlJSONuiconfig
)
{
await
TestUserConfiguration
(
userconfig
)
await
TestUserConfiguration
(
userconfig
)
print
(
"ReadTestdataFromGitHub: loading userconfiguration COMPLETED)"
)
print
(
"ReadTestdataFromGitHub: loading userconfiguration COMPLETED)"
)
}
}
...
@@ -24,7 +27,7 @@ final class ReadTestdataFromGitHub {
...
@@ -24,7 +27,7 @@ final class ReadTestdataFromGitHub {
}
}
// Load data
// Load data
do
{
do
{
if
let
testdata
=
try
await
testdata
.
gettestdatabyURL
(
)
{
if
let
testdata
=
try
await
testdata
.
loadanddecodearraydata
(
DecodeTestdata
.
self
,
fromwhere
:
urlJSON
)
{
testconfigurations
.
removeAll
()
testconfigurations
.
removeAll
()
for
i
in
0
..<
testdata
.
count
{
for
i
in
0
..<
testdata
.
count
{
var
configuration
=
TestSynchronizeConfiguration
(
testdata
[
i
])
var
configuration
=
TestSynchronizeConfiguration
(
testdata
[
i
])
...
...
This diff is collapsed.
Click to expand it.
Tests/SSHCreateKeyTests/TestdataFromGitHub.swift
+
7
−
11
View file @
8a6e2d5a
...
@@ -11,23 +11,19 @@ struct TestdataFromGitHub {
...
@@ -11,23 +11,19 @@ struct TestdataFromGitHub {
let
urlSession
=
URLSession
.
shared
let
urlSession
=
URLSession
.
shared
let
jsonDecoder
=
JSONDecoder
()
let
jsonDecoder
=
JSONDecoder
()
private
var
urlJSON
:
String
=
"https://raw.githubusercontent.com/rsyncOSX/RsyncArguments/master/Testdata/configurations.json"
func
loadanddecodestringdata
<
T
:
Codable
>
(
_
t
:
T
.
Type
,
fromwhere
:
String
)
async
throws
->
T
?
{
if
let
url
=
URL
(
string
:
fromwhere
)
{
func
gettestdatabyURL
()
async
throws
->
[
DecodeTestdata
]?
{
if
let
url
=
URL
(
string
:
urlJSON
)
{
let
(
data
,
_
)
=
try
await
urlSession
.
gettestdata
(
for
:
url
)
let
(
data
,
_
)
=
try
await
urlSession
.
gettestdata
(
for
:
url
)
return
try
jsonDecoder
.
decode
(
[
DecodeTestdata
]
.
self
,
from
:
data
)
return
try
jsonDecoder
.
decode
(
T
.
self
,
from
:
data
)
}
else
{
}
else
{
return
nil
return
nil
}
}
}
}
private
var
urlJSONuiconfig
:
String
=
"https://raw.githubusercontent.com/rsyncOSX/RsyncArguments/master/Testdata/rsyncuiconfig.json"
func
loadanddecodearraydata
<
T
:
Codable
>
(
_
t
:
T
.
Type
,
fromwhere
:
String
)
async
throws
->
[
T
]?
{
if
let
url
=
URL
(
string
:
fromwhere
)
{
func
getrsyncuiconfigbyURL
()
async
throws
->
DecodeTestUserConfiguration
?
{
if
let
url
=
URL
(
string
:
urlJSONuiconfig
)
{
let
(
data
,
_
)
=
try
await
urlSession
.
gettestdata
(
for
:
url
)
let
(
data
,
_
)
=
try
await
urlSession
.
gettestdata
(
for
:
url
)
return
try
jsonDecoder
.
decode
(
DecodeTestUserConfiguration
.
self
,
from
:
data
)
return
try
jsonDecoder
.
decode
(
[
T
]
.
self
,
from
:
data
)
}
else
{
}
else
{
return
nil
return
nil
}
}
...
...
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