Prepare for unit tests
This commit is contained in:
parent
309b240cdc
commit
4e7cf06abf
2 changed files with 14 additions and 2 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -25,3 +25,4 @@ go.work.sum
|
||||||
# env file
|
# env file
|
||||||
.env
|
.env
|
||||||
|
|
||||||
|
main
|
||||||
|
|
|
||||||
|
|
@ -10,10 +10,21 @@ import (
|
||||||
"vix.ro/sonix/azure_migrate/internal/forgejo"
|
"vix.ro/sonix/azure_migrate/internal/forgejo"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
type AzureClient interface {
|
||||||
|
GetRepositories() ([]azure.Repository, error)
|
||||||
|
GetAuthenticatedURL(remoteURL, pat string) string
|
||||||
|
}
|
||||||
|
|
||||||
|
type ForgejoClient interface {
|
||||||
|
GetUser(username string) (*forgejo.User, error)
|
||||||
|
RepositoryExists(owner, name string) (bool, error)
|
||||||
|
CreateMirror(req forgejo.MigrateRequest) (*forgejo.Repository, error)
|
||||||
|
}
|
||||||
|
|
||||||
type Migrator struct {
|
type Migrator struct {
|
||||||
config *config.Config
|
config *config.Config
|
||||||
azureClient *azure.Client
|
azureClient AzureClient
|
||||||
forgejoClient *forgejo.Client
|
forgejoClient ForgejoClient
|
||||||
errors []error
|
errors []error
|
||||||
mu sync.Mutex
|
mu sync.Mutex
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue