-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Iplement session token support and keep-alive.
- Loading branch information
1 parent
f1d7dcd
commit 3b31a21
Showing
4 changed files
with
49 additions
and
28 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
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 |
---|---|---|
|
@@ -17,7 +17,7 @@ func Example() { | |
// Create a new Panasonic Comfort Cloud client | ||
client := cloudcontrol.NewClient("") | ||
// Initiate a session with your username and password | ||
client.CreateSession("", "username", "password") | ||
client.CreateSession("username", "password") | ||
// List the available devices in your account | ||
devices, _ := client.ListDevices() | ||
// Set the device we want to control | ||
|
@@ -107,7 +107,7 @@ func TestSetDevice(t *testing.T) { | |
} | ||
|
||
func TestTurnOn(t *testing.T) { | ||
client.CreateSession("", "", "") | ||
client.CreateSession("", "") | ||
body, err := client.TurnOn() | ||
if err != nil { | ||
t.Errorf("TestTurnOn() returned an error: %v", err) | ||
|
@@ -120,7 +120,7 @@ func TestTurnOn(t *testing.T) { | |
} | ||
|
||
func TestGetGroups(t *testing.T) { | ||
client.CreateSession("", "", "") | ||
client.CreateSession("", "") | ||
groups, _ := client.GetGroups() | ||
want := "My House" | ||
got := groups.Groups[0].GroupName | ||
|
@@ -135,9 +135,8 @@ func TestGetGroups(t *testing.T) { | |
func TestCreateSessionCustomToken(t *testing.T) { | ||
username := "" | ||
password := "" | ||
token := "token12345" | ||
|
||
body, _ := client.CreateSession(token, username, password) | ||
body, _ := client.CreateSession(username, password) | ||
if body != nil { | ||
t.Error("TestCreateSessionCustomToken() got non-nil body") | ||
} | ||
|
@@ -152,9 +151,8 @@ func TestCreateSessionCustomToken(t *testing.T) { | |
func TestCreateSession(t *testing.T) { | ||
username := "[email protected]" | ||
password := "secret1234" | ||
token := "" | ||
|
||
client.CreateSession(token, username, password) | ||
client.CreateSession(username, password) | ||
|
||
got := client.Utoken | ||
want := "token12345" | ||
|
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
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