def test_tag(self): """Test creation of a repository object with a tag """ name = 'test_repo' protocol = 'test_protocol' url = 'test_url' tag = 'test_tag' repo_info = { ExternalsDescription.PROTOCOL: protocol, ExternalsDescription.REPO_URL: url, ExternalsDescription.TAG: tag, ExternalsDescription.BRANCH: EMPTY_STR, } repo = Repository(name, repo_info) print(repo.__dict__) self.assertEqual(repo.tag(), tag) self.assertEqual(repo.url(), url)
def test_branch(self): """Test creation of a repository object with a branch """ name = 'test_repo' protocol = 'test_protocol' url = 'test_url' branch = 'test_branch' repo_info = { ExternalsDescription.PROTOCOL: protocol, ExternalsDescription.REPO_URL: url, ExternalsDescription.BRANCH: branch, ExternalsDescription.TAG: EMPTY_STR, } repo = Repository(name, repo_info) print(repo.__dict__) self.assertEqual(repo.branch(), branch) self.assertEqual(repo.url(), url)
def test_hash(self): """Test creation of a repository object with a hash """ name = 'test_repo' protocol = 'test_protocol' url = 'test_url' ref = 'deadc0de' repo_info = { ExternalsDescription.PROTOCOL: protocol, ExternalsDescription.REPO_URL: url, ExternalsDescription.BRANCH: EMPTY_STR, ExternalsDescription.TAG: EMPTY_STR, ExternalsDescription.HASH: ref, } repo = Repository(name, repo_info) print(repo.__dict__) self.assertEqual(repo.hash(), ref) self.assertEqual(repo.url(), url)
def test_no_tag_no_branch(self): """Test creation of a repository object without a tag or branch raises a runtimer error. """ name = 'test_repo' protocol = 'test_protocol' url = 'test_url' branch = EMPTY_STR tag = EMPTY_STR repo_info = { ExternalsDescription.PROTOCOL: protocol, ExternalsDescription.REPO_URL: url, ExternalsDescription.BRANCH: branch, ExternalsDescription.TAG: tag, } with self.assertRaises(RuntimeError): Repository(name, repo_info)
def test_tag_branch_hash(self): """Test creation of a repository object with a tag, branch and hash raises a runtimer error. """ name = 'test_repo' protocol = 'test_protocol' url = 'test_url' branch = 'test_branch' tag = 'test_tag' ref = 'deadc0de' repo_info = { ExternalsDescription.PROTOCOL: protocol, ExternalsDescription.REPO_URL: url, ExternalsDescription.BRANCH: branch, ExternalsDescription.TAG: tag, ExternalsDescription.HASH: ref, } with self.assertRaises(RuntimeError): Repository(name, repo_info)
def test_tag_branch(self): """Test creation of a repository object with a tag and branch raises a runtimer error. """ name = 'test_repo' protocol = 'test_protocol' url = 'test_url' branch = 'test_branch' tag = 'test_tag' ref = EMPTY_STR sparse = EMPTY_STR repo_info = { ExternalsDescription.PROTOCOL: protocol, ExternalsDescription.REPO_URL: url, ExternalsDescription.BRANCH: branch, ExternalsDescription.TAG: tag, ExternalsDescription.HASH: ref, ExternalsDescription.SPARSE: sparse, } with self.assertRaises(RuntimeError): Repository(name, repo_info)