Cloud: preserve brand for EU Data Act vehicles (#31429)
This commit is contained in:
parent
eea55d282d
commit
c898954458
3 changed files with 17 additions and 1 deletions
|
|
@ -35,7 +35,11 @@ func NewFromConfig(ctx context.Context, typ string, other map[string]any) (api.V
|
|||
}
|
||||
|
||||
if cc.Cloud {
|
||||
cc.Other["brand"] = typ
|
||||
// keep an explicit brand (e.g. drivesomethinggreater's Audi/Seat/...);
|
||||
// otherwise the type itself is the brand (legacy per-brand vehicles)
|
||||
if _, ok := cc.Other["brand"]; !ok {
|
||||
cc.Other["brand"] = typ
|
||||
}
|
||||
typ = "cloud"
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -97,6 +97,12 @@ func TestResolveBrand(t *testing.T) {
|
|||
|
||||
_, ok := resolveBrand("nope")
|
||||
assert.False(t, ok)
|
||||
|
||||
// IsBrand drives the cloud server's brand -> drivesomethinggreater routing
|
||||
for _, name := range []string{"audi", "Volkswagen", "seat", "CUPRA", "skoda"} {
|
||||
assert.True(t, IsBrand(name), "%q is a VW group brand", name)
|
||||
}
|
||||
assert.False(t, IsBrand("tesla"))
|
||||
}
|
||||
|
||||
func TestPending(t *testing.T) {
|
||||
|
|
|
|||
|
|
@ -38,6 +38,12 @@ func resolveBrand(name string) (brand, bool) {
|
|||
return brand{}, false
|
||||
}
|
||||
|
||||
// IsBrand reports whether name is a known VW group brand (case-insensitive)
|
||||
func IsBrand(name string) bool {
|
||||
_, ok := resolveBrand(name)
|
||||
return ok
|
||||
}
|
||||
|
||||
// Vehicle is a single entry of the portal vehicle list. VIN and name carry
|
||||
// several alternative field names depending on the response variant.
|
||||
type Vehicle struct {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue