mirror of
https://github.com/woodchen-ink/webp_server_go.git
synced 2025-07-18 05:32:02 +08:00
* use GitHub Actions as CI * bump versions * Makefile and Dockerfile improvements * upgrade logrus
37 lines
659 B
Go
37 lines
659 B
Go
// webp_server_go - update_test
|
|
// 2020-11-10 09:36
|
|
// Benny <benny.think@gmail.com>
|
|
|
|
package main
|
|
|
|
import (
|
|
"github.com/stretchr/testify/assert"
|
|
"os"
|
|
"testing"
|
|
)
|
|
|
|
func TestNormalAutoUpdate(t *testing.T) {
|
|
version = "0.0.1"
|
|
dir := "./update"
|
|
autoUpdate()
|
|
assert.NotEqual(t, 0, fileCount(dir))
|
|
_ = os.RemoveAll(dir)
|
|
}
|
|
|
|
func Test404AutoUpdate(t *testing.T) {
|
|
version = "0.0.1"
|
|
dir := "./update"
|
|
releaseUrl = releaseUrl + "a"
|
|
autoUpdate()
|
|
assert.Equal(t, int64(0), fileCount(dir))
|
|
_ = os.RemoveAll(dir)
|
|
}
|
|
|
|
func TestNoNeedAutoUpdate(t *testing.T) {
|
|
version = "99.99"
|
|
dir := "./update"
|
|
autoUpdate()
|
|
info, _ := os.Stat(dir)
|
|
assert.Nil(t, info)
|
|
}
|