summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authoraviac <aviac@mailbox.org>2024-05-10 09:05:37 +0200
committeraviac <aviac@mailbox.org>2024-05-10 09:05:52 +0200
commit5fc28346e699b4b65a6596db386416c04bd1ea04 (patch)
tree372e12d4953f7ceba0732214a71b0c20e3bf2cee /tests
parentfeat: naive implementation of ssh_url deserialization (diff)
downloadforgejo-api-5fc28346e699b4b65a6596db386416c04bd1ea04.tar.xz
forgejo-api-5fc28346e699b4b65a6596db386416c04bd1ea04.zip
test: add a small 🤏 cute 🥺 test to prove it works
Diffstat (limited to 'tests')
-rw-r--r--tests/ci_test.rs6
-rw-r--r--tests/repo_data.json91
2 files changed, 97 insertions, 0 deletions
diff --git a/tests/ci_test.rs b/tests/ci_test.rs
index 6eca774..d51a274 100644
--- a/tests/ci_test.rs
+++ b/tests/ci_test.rs
@@ -430,3 +430,9 @@ async fn admin() {
.await
.expect("failed to delete hook");
}
+
+#[test]
+fn ssh_url_deserialization() {
+ let data = include_str!("./repo_data.json");
+ assert!(serde_json::from_str::<Repository>(data).is_ok());
+}
diff --git a/tests/repo_data.json b/tests/repo_data.json
new file mode 100644
index 0000000..81e94de
--- /dev/null
+++ b/tests/repo_data.json
@@ -0,0 +1,91 @@
+{
+ "id": 160106,
+ "owner": {
+ "id": 94809,
+ "login": "Cyborus",
+ "login_name": "",
+ "full_name": "",
+ "email": "cyborus@noreply.codeberg.org",
+ "avatar_url": "https://codeberg.org/avatars/53e78f627539c6a0b96854028529779133724a5df2d2c229e5d0eb48aaa3d1fa",
+ "language": "",
+ "is_admin": false,
+ "last_login": "0001-01-01T00:00:00Z",
+ "created": "2023-04-30T00:54:15Z",
+ "restricted": false,
+ "active": false,
+ "prohibit_login": false,
+ "location": "",
+ "pronouns": "",
+ "website": "https://cyborus.xyz",
+ "description": "I host my own Forgejo instance at https://code.cartoon-aa.xyz/",
+ "visibility": "public",
+ "followers_count": 4,
+ "following_count": 4,
+ "starred_repos_count": 8,
+ "username": "Cyborus"
+ },
+ "name": "forgejo-api",
+ "full_name": "Cyborus/forgejo-api",
+ "description": "Rust crate to interact with the Forgejo API",
+ "empty": false,
+ "private": false,
+ "fork": false,
+ "template": false,
+ "parent": null,
+ "mirror": false,
+ "size": 1481,
+ "language": "Rust",
+ "languages_url": "https://codeberg.org/api/v1/repos/Cyborus/forgejo-api/languages",
+ "html_url": "https://codeberg.org/Cyborus/forgejo-api",
+ "url": "https://codeberg.org/api/v1/repos/Cyborus/forgejo-api",
+ "link": "",
+ "ssh_url": "git@codeberg.org:Cyborus/forgejo-api.git",
+ "clone_url": "https://codeberg.org/Cyborus/forgejo-api.git",
+ "original_url": "",
+ "website": "",
+ "stars_count": 4,
+ "forks_count": 1,
+ "watchers_count": 2,
+ "open_issues_count": 2,
+ "open_pr_counter": 0,
+ "release_counter": 2,
+ "default_branch": "main",
+ "archived": false,
+ "created_at": "2023-11-09T17:42:18Z",
+ "updated_at": "2024-04-27T22:42:52Z",
+ "archived_at": "1970-01-01T00:00:00Z",
+ "permissions": {
+ "admin": false,
+ "push": false,
+ "pull": true
+ },
+ "has_issues": true,
+ "internal_tracker": {
+ "enable_time_tracker": true,
+ "allow_only_contributors_to_track_time": true,
+ "enable_issue_dependencies": true
+ },
+ "has_wiki": false,
+ "wiki_branch": "master",
+ "has_pull_requests": true,
+ "has_projects": true,
+ "has_releases": true,
+ "has_packages": false,
+ "has_actions": false,
+ "ignore_whitespace_conflicts": false,
+ "allow_merge_commits": true,
+ "allow_rebase": true,
+ "allow_rebase_explicit": true,
+ "allow_squash_merge": true,
+ "allow_fast_forward_only_merge": false,
+ "allow_rebase_update": true,
+ "default_delete_branch_after_merge": true,
+ "default_merge_style": "merge",
+ "default_allow_maintainer_edit": true,
+ "avatar_url": "",
+ "internal": false,
+ "mirror_interval": "",
+ "object_format_name": "sha1",
+ "mirror_updated": "0001-01-01T00:00:00Z",
+ "repo_transfer": null
+}