@@ -167,13 +167,38 @@ func TestCommit(t *testing.T) {
167167 local .Do ("touch test.file" )
168168
169169 s .AddAll ()
170- s .Commit ("Commit test.file" )
170+ _ , _ , err := s .Commit ("Commit test.file" )
171+ if err != nil {
172+ t .Error (err )
173+ }
171174
172- stdout , _ , err := local .Do (`git status | grep "%s"` , branchIsAhead )
175+ stdout , _ , _ := local .Do (`git status | grep "%s"` , branchIsAhead )
173176 if stdout .String () == "" {
174177 t .Errorf ("Branch should be 1 commit ahead" )
175178 }
179+ }
180+
181+ func TestPushU (t * testing.T ) {
182+ local , _ , teardown := testenv .SetupEnv (t )
183+ defer teardown ()
184+
185+ branchIsUpToDate := "Your branch is up to date with 'origin/master'"
186+ s := setupNativeGitService (local .Folder )
187+ local .Do ("touch test.file" )
188+ s .AddAll ()
189+ s .Commit ("Commit test.file" )
190+ stdout , _ , _ := local .Do (`git status | grep "%s"` , branchIsUpToDate )
191+ if stdout .String () != "" {
192+ t .Error ("Branch should NOT be up to date" )
193+ }
194+
195+ _ , _ , err := s .Push (false )
176196 if err != nil {
177- t .Errorf (err .Error ())
197+ t .Error (err )
198+ }
199+
200+ stdout , _ , _ = local .Do (`git status | grep "%s"` , branchIsUpToDate )
201+ if stdout .String () == "" {
202+ t .Error ("Branch should be up to date" )
178203 }
179204}
0 commit comments