-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(publish): Use Refselect for publish, so FSI works. Use dsref, add…
… tests.
- Loading branch information
Showing
6 changed files
with
107 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package cmd | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/qri-io/qri/registry" | ||
"github.com/qri-io/qri/registry/regserver" | ||
) | ||
|
||
// Test publishing to a mock registry | ||
func TestPublish(t *testing.T) { | ||
run := NewTestRunner(t, "test_peer", "qri_test_registry_publish") | ||
defer run.Delete() | ||
|
||
reg, cleanup, err := regserver.NewTempRegistry("temp_registry", "") | ||
if err != nil { | ||
t.Fatal(err) | ||
} | ||
defer cleanup() | ||
|
||
// Create a mock registry, point our test runner to its URL | ||
_, httpServer := regserver.NewMockServerRegistry(*reg) | ||
run.RepoRoot.GetConfig().Registry.Location = httpServer.URL | ||
err = run.RepoRoot.WriteConfigFile() | ||
if err != nil { | ||
t.Fatal(err) | ||
} | ||
|
||
// Save one commit | ||
run.MustExec(t, "qri save me/one_ds --body testdata/movies/body_ten.csv") | ||
|
||
// Publish to the registry | ||
run.MustExec(t, "qri publish me/one_ds") | ||
|
||
// Search, verify that we get the dataset back | ||
results, err := reg.Search.Search(registry.SearchParams{ | ||
Q: "", | ||
Limit: 2, | ||
Offset: 0, | ||
}) | ||
if err != nil { | ||
t.Fatal(err) | ||
} | ||
|
||
if len(results) != 1 { | ||
t.Errorf("expected: 1 result, got %d results", len(results)) | ||
} | ||
if results[0].Name != "one_ds" { | ||
t.Errorf("expected: dataset named \"one_ds\", got %q", results[0].Name) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters