@@ -19,7 +19,7 @@ import (
1919)
2020
2121const (
22- fixtureFile = "../fixture.txt"
22+ fixtureFile = "../fixture.txt"
2323)
2424
2525func Test_getFilesToAdd (t * testing.T ) {
@@ -243,7 +243,7 @@ func Test_editRun(t *testing.T) {
243243 wantStderr : "You do not own this gist." ,
244244 },
245245 {
246- name : "add file to existing gist with absolute path " ,
246+ name : "add file to existing gist" ,
247247 gist : & shared.Gist {
248248 ID : "1234" ,
249249 Files : map [string ]* shared.GistFile {
@@ -260,50 +260,7 @@ func Test_editRun(t *testing.T) {
260260 httpmock .StatusStringResponse (201 , "{}" ))
261261 },
262262 opts : & EditOptions {
263- AddFilename : "/Users/octocat/foo.txt" ,
264- },
265- wantParams : map [string ]interface {}{
266- "description" : "" ,
267- "updated_at" : "0001-01-01T00:00:00Z" ,
268- "public" : false ,
269- "files" : map [string ]interface {}{
270- "foo.txt" : map [string ]interface {}{
271- "content" : "new content to existing gist" ,
272- "filename" : "foo.txt" ,
273- },
274- },
275- },
276- },
277- {
278- name : "add file to existing gist with relative path" ,
279- gist : & shared.Gist {
280- ID : "1234" ,
281- Files : map [string ]* shared.GistFile {
282- "sample.txt" : {
283- Filename : "sample.txt" ,
284- Content : "bwhiizzzbwhuiiizzzz" ,
285- Type : "text/plain" ,
286- },
287- },
288- Owner : & shared.GistOwner {Login : "octocat" },
289- },
290- httpStubs : func (reg * httpmock.Registry ) {
291- reg .Register (httpmock .REST ("POST" , "gists/1234" ),
292- httpmock .StatusStringResponse (201 , "{}" ))
293- },
294- opts : & EditOptions {
295- AddFilename : "../foo.txt" ,
296- },
297- wantParams : map [string ]interface {}{
298- "description" : "" ,
299- "updated_at" : "0001-01-01T00:00:00Z" ,
300- "public" : false ,
301- "files" : map [string ]interface {}{
302- "foo.txt" : map [string ]interface {}{
303- "content" : "new content to existing gist" ,
304- "filename" : "foo.txt" ,
305- },
306- },
263+ AddFilename : "../fixture.txt" ,
307264 },
308265 },
309266 }
@@ -338,10 +295,6 @@ func Test_editRun(t *testing.T) {
338295 return "new file content" , nil
339296 }
340297
341- tt .opts .Add = func (_ , _ string , _ * iostreams.IOStreams ) (string , error ) {
342- return "new content to existing gist" , nil
343- }
344-
345298 tt .opts .HttpClient = func () (* http.Client , error ) {
346299 return & http.Client {Transport : reg }, nil
347300 }
0 commit comments