Words typo in codes fixed.

This commit is contained in:
Naoki Kosaka
2021-06-20 17:26:15 +09:00
parent 4dd69d0dac
commit f05921420f
20 changed files with 85 additions and 85 deletions

View File

@ -20,13 +20,13 @@ func configCmdInit() *cobra.Command {
var config = &cobra.Command{
Use: "config",
Short: "Manage configuration for relay",
Long: "Enable/disable relay costomize and import/export relay database.",
Long: "Enable/disable relay customize and import/export relay database.",
}
var configList = &cobra.Command{
Use: "list",
Short: "List all relay configration",
Long: "List all relay configration.",
Short: "List all relay configuration",
Long: "List all relay configuration.",
Run: func(cmd *cobra.Command, args []string) {
initProxy(listConfig, cmd, args)
},
@ -57,8 +57,8 @@ func configCmdInit() *cobra.Command {
var configEnable = &cobra.Command{
Use: "enable",
Short: "Enable/disable relay configration",
Long: `Enable or disable relay configration.
Short: "Enable/disable relay configuration",
Long: `Enable or disable relay configuration.
- service-block
Blocking feature for service-type actor.
- manually-accept
@ -70,7 +70,7 @@ func configCmdInit() *cobra.Command {
return initProxyE(configEnable, cmd, args)
},
}
configEnable.Flags().BoolP("disable", "d", false, "Disable configration instead of Enable")
configEnable.Flags().BoolP("disable", "d", false, "Disable configuration instead of Enable")
config.AddCommand(configEnable)
return config
@ -168,6 +168,6 @@ func importConfig(cmd *cobra.Command, args []string) {
ActivityID: Subscription.ActivityID,
ActorID: Subscription.ActorID,
})
cmd.Println("Regist [" + Subscription.Domain + "] as subscriber")
cmd.Println("Register [" + Subscription.Domain + "] as subscriber")
}
}

View File

@ -73,7 +73,7 @@ func TestInvalidConfig(t *testing.T) {
app := configCmdInit()
buffer := new(bytes.Buffer)
app.SetOutput(buffer)
app.SetOut(buffer)
app.SetArgs([]string{"enable", "hoge"})
app.Execute()
@ -89,7 +89,7 @@ func TestListConfig(t *testing.T) {
app := configCmdInit()
buffer := new(bytes.Buffer)
app.SetOutput(buffer)
app.SetOut(buffer)
app.SetArgs([]string{"list"})
app.Execute()
@ -118,7 +118,7 @@ func TestExportConfig(t *testing.T) {
app := configCmdInit()
buffer := new(bytes.Buffer)
app.SetOutput(buffer)
app.SetOut(buffer)
app.SetArgs([]string{"export"})
app.Execute()
@ -127,7 +127,7 @@ func TestExportConfig(t *testing.T) {
if err != nil {
t.Fatalf("Test resource fetch error.")
}
jsonData, err := ioutil.ReadAll(file)
jsonData, _ := ioutil.ReadAll(file)
output := buffer.String()
if strings.Split(output, "\n")[0] != string(jsonData) {
t.Fatalf("Invalid Response.")
@ -144,7 +144,7 @@ func TestImportConfig(t *testing.T) {
relayState.Load()
buffer := new(bytes.Buffer)
app.SetOutput(buffer)
app.SetOut(buffer)
app.SetArgs([]string{"export"})
app.Execute()
@ -153,7 +153,7 @@ func TestImportConfig(t *testing.T) {
if err != nil {
t.Fatalf("Test resource fetch error.")
}
jsonData, err := ioutil.ReadAll(file)
jsonData, _ := ioutil.ReadAll(file)
output := buffer.String()
if strings.Split(output, "\n")[0] != string(jsonData) {
t.Fatalf("Invalid Response.")

View File

@ -64,7 +64,7 @@ func createUnfollowRequestResponse(subscription models.Subscription) error {
resp := activity.GenerateResponse(globalConfig.ServerHostname(), "Reject")
jsonData, _ := json.Marshal(&resp)
pushRegistorJob(subscription.InboxURL, jsonData)
pushRegisterJob(subscription.InboxURL, jsonData)
return nil
}

View File

@ -17,7 +17,7 @@ func TestListDomainSubscriber(t *testing.T) {
buffer := new(bytes.Buffer)
app = domainCmdInit()
app.SetOutput(buffer)
app.SetOut(buffer)
app.SetArgs([]string{"list"})
app.Execute()
@ -43,7 +43,7 @@ func TestListDomainLimited(t *testing.T) {
buffer := new(bytes.Buffer)
app = domainCmdInit()
app.SetOutput(buffer)
app.SetOut(buffer)
app.SetArgs([]string{"list", "-t", "limited"})
app.Execute()
@ -69,7 +69,7 @@ func TestListDomainBlocked(t *testing.T) {
buffer := new(bytes.Buffer)
app = domainCmdInit()
app.SetOutput(buffer)
app.SetOut(buffer)
app.SetArgs([]string{"list", "-t", "blocked"})
app.Execute()
@ -187,7 +187,7 @@ func TestSetDomainInvalid(t *testing.T) {
buffer := new(bytes.Buffer)
app = domainCmdInit()
app.SetOutput(buffer)
app.SetOut(buffer)
app.SetArgs([]string{"set", "-t", "hoge", "hoge.example.jp"})
app.Execute()
@ -234,7 +234,7 @@ func TestInvalidUnfollowDomain(t *testing.T) {
buffer := new(bytes.Buffer)
app = domainCmdInit()
app.SetOutput(buffer)
app.SetOut(buffer)
app.SetArgs([]string{"unfollow", "unknown.tld"})
app.Execute()

View File

@ -64,9 +64,9 @@ func followCmdInit() *cobra.Command {
return follow
}
func pushRegistorJob(inboxURL string, body []byte) {
func pushRegisterJob(inboxURL string, body []byte) {
job := &tasks.Signature{
Name: "registor",
Name: "register",
RetryCount: 25,
Args: []tasks.Arg{
{
@ -105,7 +105,7 @@ func createFollowRequestResponse(domain string, response string) error {
if err != nil {
return err
}
pushRegistorJob(data["inbox_url"], jsonData)
pushRegisterJob(data["inbox_url"], jsonData)
relayState.RedisClient.Del("relay:pending:" + domain)
if response == "Accept" {
relayState.AddSubscription(models.Subscription{
@ -133,7 +133,7 @@ func createUpdateActorActivity(subscription models.Subscription) error {
if err != nil {
return err
}
pushRegistorJob(subscription.InboxURL, jsonData)
pushRegisterJob(subscription.InboxURL, jsonData)
return nil
}

View File

@ -12,7 +12,7 @@ func TestListFollows(t *testing.T) {
app := followCmdInit()
buffer := new(bytes.Buffer)
app.SetOutput(buffer)
app.SetOut(buffer)
relayState.RedisClient.HMSet("relay:pending:example.com", map[string]interface{}{
"inbox_url": "https://example.com/inbox",
@ -95,7 +95,7 @@ func TestInvalidFollow(t *testing.T) {
app := followCmdInit()
buffer := new(bytes.Buffer)
app.SetOutput(buffer)
app.SetOut(buffer)
app.SetArgs([]string{"accept", "unknown.tld"})
app.Execute()
@ -112,7 +112,7 @@ func TestInvalidRejectFollow(t *testing.T) {
app := followCmdInit()
buffer := new(bytes.Buffer)
app.SetOutput(buffer)
app.SetOut(buffer)
app.SetArgs([]string{"reject", "unknown.tld"})
app.Execute()