-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_vcs.py
37 lines (31 loc) · 1.1 KB
/
test_vcs.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
from unittest import TestCase
from fastgrpc.helpers.vcs import clone, commit, push
import shutil
import uuid
import os
class TestVCS(TestCase):
repo_url = "https://github.com/ashupednekar/testrpcassets"
path = "test_one"
def tearDown(self) -> None:
...
# shutil.rmtree(self.path)
def test_clone(self):
clone(self.repo_url, self.path)
self.assertTrue(os.path.exists("test_one"))
def test_commit(self):
clone(self.repo_url, self.path)
with open(f"{self.path}/test.txt", "w") as f:
f.write(uuid.uuid4().hex)
commit(self.path, "test commit")
with open(f"{self.path}/test.txt", "w") as f:
f.write(uuid.uuid4().hex)
commit(self.path, "test commit one")
def test_push(self):
clone(self.repo_url, self.path)
with open(f"{self.path}/test.txt", "w") as f:
f.write(uuid.uuid4().hex)
commit(self.path, "test commit")
with open(f"{self.path}/test.txt", "w") as f:
f.write(uuid.uuid4().hex)
commit(self.path, "test commit one")
push(self.path)