Organization: Add identifier property

parent 7cf35532
......@@ -39,6 +39,13 @@ class GitHubOrganization(GitHubMixin, Organization):
self._name = name
self._url = '/orgs/{name}'.format(name=quote_plus(name))
@property
def identifier(self) -> int:
"""
Returns the identifier of the organization.
"""
return self.data['id']
@property
def description(self) -> str:
"""
......
......@@ -35,6 +35,13 @@ class GitLabOrganization(GitLabMixin, Organization):
self._url = '/groups/{name}'.format(name=quote_plus(name))
self._is_user = None
@property
def identifier(self) -> int:
"""
Returns the identifier of the organization.
"""
return self.data['id']
@property
def description(self) -> str:
"""
......
......@@ -15,6 +15,13 @@ class Organization(IGittObject):
"""
Represents an organization on GitHub or GitLab.
"""
@property
def identifier(self) -> int:
"""
Returns the identifier of the organization.
"""
raise NotImplementedError
@property
def description(self) -> str:
"""
......
interactions:
- request:
body: '{}'
headers:
Accept: ['*/*']
Accept-Encoding: ['gzip, deflate']
Connection: [keep-alive]
Content-Length: ['2']
Content-Type: [application/json]
If-None-Match: [W/"ec18392c3f0ebf09d4575f00cf91e3ed"]
User-Agent: [IGitt]
method: GET
uri: https://api.github.com/orgs/gitmate-test-org?per_page=100
response:
body:
string: !!binary |
H4sIAAAAAAAAA6WTy27CMBBF/8VrQoKbCrBUVZX6UBeIDYuqm8hJBmLq2JYfqVLEv3eS0IpSNqW7
xJ57bM+9syNSb4QijGyEr7mHyIPzkbYbMiKiJOyK0iSd02RElC4h65bI4v6hXb7N21f6GPiLqcon
2eTbRbvY3iXL1fM7SoOVWFh5bxyLY27EGPlVyMeFrmOku/jMeRaMdtnfpXEvxFOhAeUvIgxKRFRa
v11E6IVd05wLcBFhUCKihjoHexHjIN3Fw8ceaSbkUhTZP6A/Ccds3nDP7all/aKjB8uDA1to5dGa
3v0Qf2XqtrlJ8YIluMIK44XucogLitdwPpGoN1y1hKkg5YjkGN5BInXBB8CwAzUXXQJ7Q7IGrFgL
wOyuuXSALnOXYQq5Eh+9LDNWb6HwjjBvw6GgT5Xw2ra/tg8dGXLH6HeTN8J1DJyWtZZSv6OLR39C
4W1xr/K1POnZ0XScGYzCAo5mmXGPT6LJZBol84jS1WTKrq/YdfqKzwymPKmZ0CiZrZKUpTOW0K7G
t6Zr7PLo5WT/CViSXFIDBAAA
headers:
Access-Control-Allow-Origin: ['*']
Access-Control-Expose-Headers: ['ETag, Link, Retry-After, X-GitHub-OTP, X-RateLimit-Limit,
X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes,
X-Poll-Interval']
Cache-Control: ['private, max-age=60, s-maxage=60']
Content-Encoding: [gzip]
Content-Security-Policy: [default-src 'none']
Content-Type: [application/json; charset=utf-8]
Date: ['Wed, 15 Aug 2018 11:44:37 GMT']
ETag: [W/"645cb3c5f9cc5715aa9240931a5c1f7f"]
Last-Modified: ['Fri, 08 Dec 2017 04:48:02 GMT']
Referrer-Policy: ['origin-when-cross-origin, strict-origin-when-cross-origin']
Server: [GitHub.com]
Status: [200 OK]
Strict-Transport-Security: [max-age=31536000; includeSubdomains; preload]
Vary: ['Accept, Authorization, Cookie, X-GitHub-OTP']
X-Accepted-OAuth-Scopes: ['admin:org, read:org, repo, user, write:org']
X-Content-Type-Options: [nosniff]
X-Frame-Options: [deny]
X-GitHub-Media-Type: [github.v3; format=json]
X-GitHub-Request-Id: ['DB72:6C02:191848E:2E2F9BF:5B741224']
X-OAuth-Client-Id: [3ed25452519b2c57840f]
X-OAuth-Scopes: ['repo, user']
X-RateLimit-Limit: ['5000']
X-RateLimit-Remaining: ['4998']
X-RateLimit-Reset: ['1534336992']
X-Runtime-rack: ['0.046326']
X-XSS-Protection: [1; mode=block]
status: {code: 200, message: OK}
version: 1
......@@ -59,3 +59,6 @@ class GitHubOrganizationTest(IGittTestCase):
def test_issues(self):
self.assertEqual(len(self.org.issues), 2)
def test_identifier(self):
self.assertEqual(self.org.identifier, 32204920)
interactions:
- request:
body: '{}'
headers:
Accept: ['*/*']
Accept-Encoding: ['gzip, deflate']
Connection: [keep-alive]
Content-Length: ['2']
Content-Type: [application/json]
If-None-Match: [W/"96788b833b272289502bd5ffa1e7fa87"]
User-Agent: [IGitt]
method: GET
uri: https://gitlab.com/api/v4/groups/gitmate-test-org?per_page=100
response:
body: {string: '{"id":1999111,"web_url":"https://gitlab.com/groups/gitmate-test-org","name":"gitmate-test-org","path":"gitmate-test-org","description":"","visibility":"public","lfs_enabled":true,"avatar_url":null,"request_access_enabled":false,"full_name":"gitmate-test-org","full_path":"gitmate-test-org","parent_id":null,"projects":[{"id":5731027,"description":"","name":"test","name_with_namespace":"gitmate-test-org
/ test","path":"test","path_with_namespace":"gitmate-test-org/test","created_at":"2018-03-12T19:21:26.165Z","default_branch":null,"tag_list":[],"ssh_url_to_repo":"[email protected]:gitmate-test-org/test.git","http_url_to_repo":"https://gitlab.com/gitmate-test-org/test.git","web_url":"https://gitlab.com/gitmate-test-org/test","readme_url":null,"avatar_url":null,"star_count":0,"forks_count":0,"last_activity_at":"2018-07-07T14:26:12.700Z","namespace":{"id":1999111,"name":"gitmate-test-org","path":"gitmate-test-org","kind":"group","full_path":"gitmate-test-org","parent_id":null},"_links":{"self":"https://gitlab.com/api/v4/projects/5731027","issues":"https://gitlab.com/api/v4/projects/5731027/issues","merge_requests":"https://gitlab.com/api/v4/projects/5731027/merge_requests","repo_branches":"https://gitlab.com/api/v4/projects/5731027/repository/branches","labels":"https://gitlab.com/api/v4/projects/5731027/labels","events":"https://gitlab.com/api/v4/projects/5731027/events","members":"https://gitlab.com/api/v4/projects/5731027/members"},"archived":false,"visibility":"public","resolve_outdated_diff_discussions":false,"container_registry_enabled":true,"issues_enabled":true,"merge_requests_enabled":true,"wiki_enabled":true,"jobs_enabled":true,"snippets_enabled":true,"shared_runners_enabled":true,"lfs_enabled":true,"creator_id":889700,"import_status":"none","open_issues_count":2,"public_jobs":true,"ci_config_path":null,"shared_with_groups":[],"only_allow_merge_if_pipeline_succeeds":false,"request_access_enabled":false,"only_allow_merge_if_all_discussions_are_resolved":false,"printing_merge_request_link_enabled":true,"merge_method":"merge","approvals_before_merge":0,"mirror":false}],"shared_projects":[],"ldap_cn":null,"ldap_access":null,"shared_runners_minutes_limit":null}'}
headers:
Cache-Control: ['max-age=0, private, must-revalidate']
Content-Length: ['2195']
Content-Type: [application/json]
Date: ['Wed, 15 Aug 2018 11:11:49 GMT']
Etag: [W/"5ab4ea8a633789c9226fe8178e060b15"]
RateLimit-Limit: ['600']
RateLimit-Observed: ['1']
RateLimit-Remaining: ['599']
RateLimit-Reset: ['1534331569']
RateLimit-ResetTime: ['Thu, 15 Aug 2018 11:12:49 GMT']
Server: [nginx]
Strict-Transport-Security: [max-age=31536000]
Vary: [Origin]
X-Content-Type-Options: [nosniff]
X-Frame-Options: [SAMEORIGIN]
X-Request-Id: [4078b4d7-cd27-4519-b14c-fdb2948929a3]
X-Runtime: ['0.111954']
status: {code: 200, message: OK}
version: 1
......@@ -75,3 +75,6 @@ class GitLabOrganizationTest(IGittTestCase):
def test_issues(self):
self.assertEqual(len(self.org.issues), 2)
def test_identifier(self):
self.assertEqual(self.org.identifier, 1999111)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment