This repository has been archived by the owner on Dec 13, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
don't depend on binary
- Loading branch information
Showing
2 changed files
with
44 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package ghbackup_test | ||
|
||
import ( | ||
"io/ioutil" | ||
"os" | ||
"testing" | ||
|
||
"qvl.io/ghbackup/ghbackup" | ||
) | ||
|
||
func TestRun(t *testing.T) { | ||
dir, err := ioutil.TempDir("", "qvl-backup") | ||
if err != nil { | ||
t.Error(err) | ||
} | ||
defer func() { | ||
err := os.RemoveAll(dir) | ||
if err != nil { | ||
t.Error(err) | ||
} | ||
}() | ||
|
||
updates := make(chan ghbackup.Update) | ||
go func() { | ||
for u := range updates { | ||
switch u.Type { | ||
case ghbackup.UErr: | ||
t.Error("Unexpected error:", u.Message) | ||
} | ||
} | ||
}() | ||
|
||
err = ghbackup.Run(ghbackup.Config{ | ||
Account: "qvl", | ||
Dir: dir, | ||
Secret: os.Getenv("SECRET"), | ||
Updates: updates, | ||
}) | ||
|
||
if err != nil { | ||
t.Error("Unexpected error:", err) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters