Skip to content

Commit

Permalink
#9 added another test for the case when the local branch and the requ…
Browse files Browse the repository at this point in the history
…ested branch are different.
  • Loading branch information
jmnavarrol committed Oct 20, 2023
1 parent ea21a20 commit e59cbdc
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion src/tests/test_gitrepo.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def test_nonexitent_branch(self):
self.assertEqual(result['status'], 'ERROR')


def test_local_not_in_remote(self):
def test_local_not_in_remote_same_branch(self):
print("TEST: 'test_local_not_in_remote'")
# prepares a suitable configuration
repoconf = {}
Expand All @@ -79,6 +79,27 @@ def test_local_not_in_remote(self):
self.assertEqual(result['status'], 'WRONG_REMOTE')


def test_local_not_in_remote_different_branch(self):
print("TEST: 'test_local_not_in_remote'")
# prepares a suitable configuration
repoconf = {}
repoconf['repo'] = '[email protected]:jmnavarrol/simplest-git-subrepos.git'
repoconf['path'] = os.path.join(self.scenarios_path, 'standard/simplest-git-subrepos')

# First, let's clone the repo
result = self.gitrepo.update(repoconf)
print(str(result))
# Then, let's create a local branch
repo = Repo(repoconf['path'])
new_branch = repo.create_head('new_branch')
# Finally, let's update config to request the new local branch
repoconf['branch'] = 'new_branch'
repoconf['gitref_type'] = 'branch'
result = self.gitrepo.update(repoconf)
print(str(result))
self.assertEqual(result['status'], 'WRONG_REMOTE')


def test_status_not_cloned(self):
print("TEST: 'test_status_not_cloned'")
# prepares a suitable configuration
Expand Down

0 comments on commit e59cbdc

Please sign in to comment.