Esempio n. 1
0
 def testParseOk(self):
     url = 'https://github.com/search?q=Tensorflow&type=Repositories'
     response = requests.get(url)
     self.soup = BeautifulSoup(response.text, "html.parser")
     strategy = Respositories()
     strategyType = Type(strategy)
     response =strategyType.search_params(response.text)
     self.assertEqual(len(response),10)
Esempio n. 2
0
class RepositoriesTest(unittest.TestCase):

    def setUp(self) -> None:
        url = 'https://github.com/search?q=Tensorflow&type=Repositories'
        response = requests.get(url)
        self.soup = BeautifulSoup(response.text, "html.parser")
        self.repositories = Respositories()

    def testRepositoriesParseOk(self):
        self.setUp()
        r = self.repositories.search_gh_data(self.soup)
        self.assertEqual(r[0]["url"],"https://github.com/tensorflow/tensorflow")
        self.assertEqual(len(r),10)

    def testRepositoriesBonus(self):
        self.setUp()
        url = "https://github.com/tensorflow/tensorflow"
        r = self.repositories.get_repo_data(url)
        self.assertEqual(r["extra"]["owner"],"tensorflow")
Esempio n. 3
0
class GHTypes(ABC):
    """
    GitHub types to select
    """

    factory = {}
    factory["Repositories"] = Respositories()
    factory["Issues"] = Issues()
    factory["Wikis"] = Wikis()

    @classmethod
    def factory_method(self, gh_types):
        if gh_types in GHTypes.factory.keys():
            return GHTypes.factory[gh_types]
        else:
            return None
Esempio n. 4
0
 def setUp(self) -> None:
     url = 'https://github.com/search?q=Tensorflow&type=Repositories'
     response = requests.get(url)
     self.soup = BeautifulSoup(response.text, "html.parser")
     self.repositories = Respositories()