class SourceTest(unittest.TestCase): """source test subclass""" def setUp(self): self.ssh_source = Source(__github_ssh_source_yaml__) self.https_source = Source(__github_https_source_yaml__) def test_get_yaml(self): """Test get_yaml() method""" self.assertEqual(self.ssh_source.get_yaml(), __github_ssh_source_yaml__) self.assertEqual(self.https_source.get_yaml(), __github_https_source_yaml__) def test_https_url_prefix(self): """Test https url prefix""" self.assertEqual(self.https_source.get_url_prefix(), 'https://github.com/') def test_member_variables(self): """Test the state of all project member variables initialized""" self.assertEqual(self.ssh_source.name, 'github-ssh') self.assertEqual(self.ssh_source.url, 'ssh://[email protected]') self.assertEqual(self.https_source.name, 'github') self.assertEqual(self.https_source.url, 'https://github.com') def test_ssh_url_prefix(self): """Test ssh url prefix""" self.assertEqual(self.ssh_source.get_url_prefix(), '[email protected]:')
class ForkTest(unittest.TestCase): """fork test subclass""" current_file_path = os.path.dirname(os.path.realpath(__file__)) cats_example_path = os.path.abspath(os.path.join(current_file_path, '..', '..', 'examples', 'cats')) def setUp(self): self.name = 'test_fork' self.remote_name = 'origin' self.fork_yaml = {'name': self.name, 'remote': self.remote_name} self.source = Source(__github_ssh_source_yaml__) self.root_directory = self.cats_example_path self.path = 'fork/path' self.fork = Fork(self.fork_yaml, self.root_directory, self.path, self.source) def test_get_yaml(self): """Test get_yaml() method""" self.assertEqual(self.fork.get_yaml(), self.fork_yaml) def test_member_variables(self): """Test the state of all project member variables initialized""" self.assertEqual(self.fork.root_directory, self.root_directory) self.assertEqual(self.fork.path, self.path) self.assertEqual(self.fork.name, self.name) self.assertEqual(self.fork.remote_name, self.remote_name) self.assertEqual(self.fork.url, self.source.get_url_prefix() + self.name + ".git")