コード例 #1
0
// Test GetAPIVersion
func TestGetAPIVersion(t *testing.T) {
	var (
		d *ICSPTest
		c *icsp.ICSPClient
	)
	if os.Getenv("ICSP_TEST_ACCEPTANCE") == "true" {
		d, c = getTestDriverA()
		if c == nil {
			t.Fatalf("Failed to execute getTestDriver() ")
		}
		data, err := c.GetAPIVersion()
		// fmt.Printf("after GetAPIVersion: %s -> (err) %s", data.CurrentVersion, err)
		// assert.Error(t,err, fmt.Sprintf("Error caught as expected: %s",err))
		assert.NoError(t, err, "GetAPIVersion threw error -> %s", err)
		assert.True(t, d.Tc.IsGreaterEqual(data.CurrentVersion, d.Tc.GetExpectsData(d.Env+"_icsp", "CurrentVersion")))
		assert.True(t, d.Tc.IsGreaterEqual(data.MinimumVersion, d.Tc.GetExpectsData(d.Env+"_icsp", "MinimumVersion")))
	} else {
		_, c = getTestDriverU()
		data, err := c.GetAPIVersion()
		assert.Error(t, err, fmt.Sprintf("ALL ok, no error, caught as expected: %s,%+v\n", err, data))
	}

}