feat: write forgejo local instance URL to json file and port tests read it
ci/woodpecker/push/woodpecker Pipeline failed Details

This commit is contained in:
Aravinth Manivannan 2023-09-18 22:15:11 +05:30
parent fa0fb859fe
commit 8551a60d46
Signed by: realaravinth
GPG Key ID: F8F50389936984FF
2 changed files with 4 additions and 2 deletions

View File

@ -307,6 +307,7 @@ class Forgejo:
data["login"] = self.username
data["email"] = self.email
data["repo"] = repo
data["forgejo_url"] = self.get_uri("")
content = json.dumps(data)
f.write(content)
print(f"Wrote access token to {file}")

View File

@ -5,14 +5,15 @@
import Forgejo from "./index";
import authtoken from "../secrets/user1-accesstoken.json";
const forgeoUrl = authtoken["forgejo_url"];
const token = authtoken["sha1"];
const username = authtoken["login"];
const repo = authtoken["repo"];
const api = new Forgejo("http://localhost:3000", "owner_user");
const api = new Forgejo(forgeoUrl, "owner_user");
api.setTokenAuth(token);
test("use authentication without setting it ", () => {
const api = new Forgejo("http://localhost:3000", "owner_user");
const api = new Forgejo(forgeoUrl, "owner_user");
expect(() => api.getTokenAuth()).toThrow();
api.setTokenAuth(token);