From 575dd002be18f170917a98f8bca891b4bd615f78 Mon Sep 17 00:00:00 2001 From: bnewbold Date: Fri, 21 Sep 2012 13:03:46 +0200 Subject: basic octopart pricing functionality --- octopart_test.go | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'octopart_test.go') diff --git a/octopart_test.go b/octopart_test.go index d2c8fbd..c86ed9b 100644 --- a/octopart_test.go +++ b/octopart_test.go @@ -26,7 +26,7 @@ func TestGetMarketInfoList(t *testing.T) { if r == nil { log.Printf("\t%d: %s", i, "nil") } else { - log.Printf("\t%d: %s", i, r.(map[string]interface{})["detail_url"]) + log.Printf("\t%d: %s", i, r["detail_url"]) } } log.Println("Running a second time, results should be cached...") @@ -38,7 +38,7 @@ func TestGetMarketInfoList(t *testing.T) { if r == nil { log.Printf("\t%d: %s", i, "nil") } else { - log.Printf("\t%d: %s", i, r.(map[string]interface{})["detail_url"]) + log.Printf("\t%d: %s", i, r["detail_url"]) } } log.Println("Running in single mode, result should be cached...") @@ -47,9 +47,9 @@ func TestGetMarketInfoList(t *testing.T) { t.Errorf("Error with api call: " + err.Error()) } if result_single == nil { - log.Printf("\t%d: %s", "nil") + log.Printf("\t%d: %s", 0, "nil") } else { - log.Printf("\t%d: %s", result_single["detail_url"]) + log.Printf("\t%d: %s", 0, result_single["detail_url"]) } } @@ -58,6 +58,10 @@ func TestAttachInfo(t *testing.T) { bm := &BomMeta{} oc := NewOctopartClient("") oc.AttachMarketInfoBom(b) - t.Errorf("unimplemented") - DumpBomAsText(bm, b, os.Stdout) + //t.Errorf("unimplemented") + //DumpBomAsText(bm, b, os.Stdout) + DumpBomMarketInfo(bm, b, os.Stdout) + log.Println("Running a second time, results should be cached...") + oc.AttachMarketInfoBom(b) + DumpBomMarketInfo(bm, b, os.Stdout) } -- cgit v1.2.3