Remove /spawn POST endpoint
This was increasing complexity for no added benefit /register now performs the spawn in 4 lines of code
This commit is contained in:
parent
6fb7ee598d
commit
b3b369f608
6 changed files with 4 additions and 147 deletions
|
@ -21,7 +21,6 @@ func Usage() {
|
|||
fmt.Fprintln(os.Stderr, "\nCommands:")
|
||||
fmt.Fprintln(os.Stderr, "\tstatus \tprints the server status")
|
||||
fmt.Fprintln(os.Stderr, "\tregister\tregisters an account and stores it (use with -name)")
|
||||
fmt.Fprintln(os.Stderr, "\tspawn \tspawns a rover for the current account")
|
||||
fmt.Fprintln(os.Stderr, "\tmove \tissues move command to rover")
|
||||
fmt.Fprintln(os.Stderr, "\tradar \tgathers radar data for the current rover")
|
||||
fmt.Fprintln(os.Stderr, "\trover \tgets data for current rover")
|
||||
|
@ -129,23 +128,6 @@ func InnerMain(command string) error {
|
|||
fmt.Printf("Registered account with id: %s\n", response.Id)
|
||||
config.Accounts[config.Host] = response.Id
|
||||
}
|
||||
case "spawn":
|
||||
d := rove.SpawnData{}
|
||||
if err := verifyId(account); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
response, err := server.Spawn(account, d)
|
||||
switch {
|
||||
case err != nil:
|
||||
return err
|
||||
|
||||
case !response.Success:
|
||||
return fmt.Errorf("Server returned failure: %s", response.Error)
|
||||
|
||||
default:
|
||||
fmt.Printf("Spawned rover with attributes %+v\n", response.Attributes)
|
||||
}
|
||||
|
||||
case "move":
|
||||
d := rove.CommandData{
|
||||
|
|
|
@ -31,7 +31,6 @@ func Test_InnerMain(t *testing.T) {
|
|||
assert.Error(t, InnerMain("register"))
|
||||
|
||||
// These methods should fail without an account
|
||||
assert.Error(t, InnerMain("spawn"))
|
||||
assert.Error(t, InnerMain("move"))
|
||||
assert.Error(t, InnerMain("radar"))
|
||||
assert.Error(t, InnerMain("rover"))
|
||||
|
@ -42,14 +41,6 @@ func Test_InnerMain(t *testing.T) {
|
|||
// Perform the register
|
||||
assert.NoError(t, InnerMain("register"))
|
||||
|
||||
// We've not spawned a rover yet so these should fail
|
||||
assert.Error(t, InnerMain("move"))
|
||||
assert.Error(t, InnerMain("radar"))
|
||||
assert.Error(t, InnerMain("rover"))
|
||||
|
||||
// Spawn a rover
|
||||
assert.NoError(t, InnerMain("spawn"))
|
||||
|
||||
// These should now work
|
||||
assert.NoError(t, InnerMain("radar"))
|
||||
assert.NoError(t, InnerMain("rover"))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue