Exemple #1
0
    def test_ctor__url(self):
        url = 'http://%s/%s/%s' % (__unit__.GITHUB_GISTS_HOST, self.OWNER,
                                   self.ID)
        gist = __unit__.Gist(url)

        self.assertEquals(url, str(gist.url))
        self.assertEquals(self.OWNER, gist.owner)
        self.assertEquals(self.ID, gist.id)
Exemple #2
0
 def test_ctor__invalid_format(self):
     with self.assert_gist_error("unrecognized", self.NOT_A_GIST):
         __unit__.Gist(self.NOT_A_GIST)
Exemple #3
0
 def test_ctor__owner_name__empty(self):
     with self.assert_gist_error("empty", self.OWNER):
         __unit__.Gist(self.OWNER, '')
Exemple #4
0
    def test_ctor__owner_name(self):
        gist = __unit__.Gist(self.OWNER, self.NAME)

        self.assertEquals(self.OWNER, gist.owner)
        self.assertEquals(self.NAME, gist.name)
Exemple #5
0
 def test_ctor__url__malformed_path(self):
     path = 'a/b/c'
     with self.assert_gist_error("invalid", path):
         __unit__.Gist('http://%s/%s' % (__unit__.GITHUB_GISTS_HOST, path))
Exemple #6
0
 def test_ctor__url__wrong_host(self):
     with self.assert_gist_error("unrecognized", "URL", self.WRONG_HOST):
         __unit__.Gist('http://' + self.WRONG_HOST)
Exemple #7
0
 def test_ctor__ref__invalid(self):
     ref = 'a/b/c'
     with self.assert_gist_error("not", "valid", "reference", ref):
         __unit__.Gist(ref)
Exemple #8
0
    def test_ctor__ref(self):
        gist = __unit__.Gist(self.OWNER + '/' + self.NAME)

        self.assertEquals(self.OWNER, gist.owner)
        self.assertEquals(self.NAME, gist.name)