Skip to content

Commit adb6acc

Browse files
authored
Merge pull request #8 from nmccrory/dev
profile and profile_test import statements for sc2 and wow packages.
2 parents 1c5d65e + fbd2cdb commit adb6acc

File tree

2 files changed

+21
-15
lines changed

2 files changed

+21
-15
lines changed

profile.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,22 @@
11
package bnet
22

3+
import (
4+
"github.com/nmccrory/go-bnet/sc2"
5+
"github.com/nmccrory/go-bnet/wow"
6+
)
37
// ProfileService has OAuth Profile APIs. See Client.
48
type ProfileService struct {
59
client *Client
610
}
711

812
// SC2Profile represents the profile information for a user's Starcraft 2 profile.
913
type SC2Profile struct {
10-
Characters []SC2Character `json:"characters"`
14+
Characters []sc2.SC2Character `json:"characters"`
1115
}
1216

1317
// WoWProfile is a collection of a user's World of Warcraft characters.
1418
type WoWProfile struct {
15-
Characters []WoWCharacter `json:"characters"`
19+
Characters []wow.WoWCharacter `json:"characters"`
1620
}
1721

1822
// SC2() calls the /sc2/profile/user endpoint. This endpoint uses OAuth2

profile_test.go

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import(
55
"net/http"
66
"testing"
77
"reflect"
8+
"github.com/nmccrory/go-bnet/sc2"
9+
"github.com/nmccrory/go-bnet/wow"
810
)
911
const sc2ProfileResp = `{ "characters":
1012
[{
@@ -111,24 +113,24 @@ func TestProfileService_SC2(t *testing.T) {
111113
if actual.Characters == nil {
112114
t.Fatal("err: This user has no Starcraft 2 profile.")
113115
}
114-
want := SC2Character{ID: 1234567,
116+
want := sc2.SC2Character{ID: 1234567,
115117
Realm: 1,
116118
DisplayName: "foobar",
117119
ClanName: "foobar",
118120
ClanTag: "foobar",
119121
ProfilePath: "/profile/1234567/1/foobar/",
120-
Portrait: CharacterImage{-10, -10, 10, 10, 10,
122+
Portrait: sc2.CharacterImage{-10, -10, 10, 10, 10,
121123
"http://media.blizzard.com/sc2/portraits/dummy.jpg"},
122-
Career: Career{"PROTOSS", 0, 0, 0,
124+
Career: sc2.Career{"PROTOSS", 0, 0, 0,
123125
"DIAMOND", 0, 100},
124-
SwarmLevels: SwarmLevels{10,
125-
Level{1, 1000, 0},
126-
Level{2, 1000, 0},
127-
Level{3, 1000, 0}},
128-
Season: Season{123, 1, 2017, 0},
129-
Rewards: Rewards{[]int{12345678, 12345678}, []int{12345678, 12345678}},
130-
Achievements: Achievements{Points{1234},
131-
[]Achievement{Achievement{123456789, 123456789}}},
126+
SwarmLevels: sc2.SwarmLevels{10,
127+
sc2.Level{1, 1000, 0},
128+
sc2.Level{2, 1000, 0},
129+
sc2.Level{3, 1000, 0}},
130+
Season: sc2.Season{123, 1, 2017, 0},
131+
Rewards: sc2.Rewards{[]int{12345678, 12345678}, []int{12345678, 12345678}},
132+
Achievements: sc2.Achievements{sc2.Points{1234},
133+
[]sc2.Achievement{sc2.Achievement{123456789, 123456789}}},
132134
}
133135
if !reflect.DeepEqual(actual.Characters[0], want) {
134136
t.Fatalf("returned %+v, want %+v", actual.Characters[0], want)
@@ -149,7 +151,7 @@ func TestProfileService_WoW(t *testing.T) {
149151
if actual.Characters == nil {
150152
t.Fatal("err: This user has no World of Warcraft characters.")
151153
}
152-
want := WoWCharacter{
154+
want := wow.WoWCharacter{
153155
Name: "foobar",
154156
Realm: "foobar",
155157
BattleGroup: "Foo",
@@ -159,7 +161,7 @@ func TestProfileService_WoW(t *testing.T) {
159161
Level: 99,
160162
AchievementPoints: 1234,
161163
Thumbnail: "foobar/123/avatar.jpg",
162-
Spec: Spec{"foobar", "foobar", "foo-bar", "foo_bar",
164+
Spec: wow.Spec{"foobar", "foobar", "foo-bar", "foo_bar",
163165
"Quick brown fox jumps over the lazy dog.", 1},
164166
Guild: "Foo",
165167
GuildRealm: "foobar",

0 commit comments

Comments
 (0)