Esempio n. 1
0
 def test_config_for_getgist(self, curl, query_api):
     curl.return_value = mock_auth(config["user"])
     query_api.return_value = config["gists"]
     gist = Gist(config["user"], config["file"])
     self.assertEqual(gist.user, config["user"])
     self.assertEqual(gist.file_name, config["file"])
     self.assertFalse(gist.assume_yes)
Esempio n. 2
0
 def test_init_for_getgist_w_auth(self, curl, get_token, query_api):
     curl.return_value = mock_auth(config["user"])
     get_token.return_value = config["user"]
     query_api.return_value = config["gists"]
     gist = Gist(config["user"], config["file"])
     hashed_url = md5(gist.raw_url.encode("utf-8")).hexdigest()
     self.assertEqual(gist.id, "409fac6ac23bf515f495")
     self.assertEqual(hashed_url, "847fe81c7fdc3b6bd7184379fcd42773")
     self.assertTrue(gist.auth)
Esempio n. 3
0
 def test_init_for_getgist_w_wrong_user(self, curl, get_token, query_api):
     curl.return_value = mock_auth("{}2".format(config["user"]))
     get_token.return_value = config["user"]
     query_api.return_value = config["gists"]
     gist = Gist(config["user"], config["file"])
     self.assertFalse(gist.auth)