<commit_before>package dh_test

import (
	"testing"
	"github.com/matryer/is"
)

func TestDevice(t *testing.T) {
	is := is.New(t)

	err := client.PutDevice("go-test-dev", nil)
	if err != nil {
		t.Errorf("%s: %v", err.Name(), err)
		return
	}

	device, err := client.GetDevice("go-test-dev")
	if err != nil {
		t.Errorf("%s: %v", err.Name(), err)
		return
	}

	is.True(device != nil)

	err = client.RemoveDevice("go-test-dev")
	if err != nil {
		t.Errorf("%s: %v", err.Name(), err)
		return
	}
}
<commit_msg>add test for device update<commit_after>package dh_test

import (
	"testing"
	"github.com/matryer/is"
	"github.com/devicehive/devicehive-go/dh"
)

func TestDevice(t *testing.T) {
	is := is.New(t)

	device := &dh.Device{
		Name: "go test",
	}

	err := client.PutDevice("go-test-dev", device)
	if err != nil {
		t.Errorf("%s: %v", err.Name(), err)
		return
	}

	device.Name = "go test updated"

	err = client.PutDevice(device.Id, device)
	if err != nil {
		t.Errorf("%s: %v", err.Name(), err)
		return
	}

	device, err = client.GetDevice(device.Id)
	if err != nil {
		t.Errorf("%s: %v", err.Name(), err)
		return
	}

	is.True(device != nil)
	is.Equal(device.Name, "go test updated")

	err = client.RemoveDevice("go-test-dev")
	if err != nil {
		t.Errorf("%s: %v", err.Name(), err)
		return
	}
}

{'fraction_non_alphanumeric': 0.20076923076923076, 'fraction_numerical': 0.0, 'mean_word_length': 3.425170068027211, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6064737', 'n_tokens_mistral': 563, 'n_tokens_neox': 534, 'n_words': 117}