A tool to migrate GitHub Repositories to Gitea including all issues
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

49 lines
1.4 KiB

package migrations
import (
func Test_githubStateToGiteaState(t *testing.T) {
open := "open"
all := "all"
closed := "closed"
tests := map[*string]string{&all: "open", &open: "open", &closed: "closed"}
for input, exceptedResult := range tests {
actualResult := githubStateToGiteaState(input)
assert.NotNil(t, actualResult)
assert.NotEmpty(t, *actualResult)
assert.Equal(t, exceptedResult, *actualResult)
nilInput := "teoafweogwoe"
assert.Nil(t, githubStateToGiteaState(&nilInput))
func TestMigratory_Label(t *testing.T) {
res, err := DemoMigratory.Label(&github.Label{
Name: github.String("testlabel"),
Color: github.String("123456"),
assertNoError(t, err)
assert.Equal(t, "123456", res.Color)
assert.Equal(t, "testlabel", res.Name)
func TestMigratory_Milestone(t *testing.T) {
res, err := DemoMigratory.Milestone(&github.Milestone{
ID: github.Int64(1),
State: github.String("open"),
Description: github.String("test milestone"),
Title: github.String("TEST"),
DueOn: &demoTime,
assertNoError(t, err)
assert.Equal(t, "TEST", res.Title)
assert.Equal(t, "test milestone", res.Description)
assert.Equal(t, demoTime.Unix(), res.Deadline.Unix())
assert.Equal(t, gitea.StateOpen, res.State)