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)
def test_ctor__invalid_format(self): with self.assert_gist_error("unrecognized", self.NOT_A_GIST): __unit__.Gist(self.NOT_A_GIST)
def test_ctor__owner_name__empty(self): with self.assert_gist_error("empty", self.OWNER): __unit__.Gist(self.OWNER, '')
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)
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))
def test_ctor__url__wrong_host(self): with self.assert_gist_error("unrecognized", "URL", self.WRONG_HOST): __unit__.Gist('http://' + self.WRONG_HOST)
def test_ctor__ref__invalid(self): ref = 'a/b/c' with self.assert_gist_error("not", "valid", "reference", ref): __unit__.Gist(ref)
def test_ctor__ref(self): gist = __unit__.Gist(self.OWNER + '/' + self.NAME) self.assertEquals(self.OWNER, gist.owner) self.assertEquals(self.NAME, gist.name)