Skip to content

Commit 71d10ff

Browse files
committed
test: unit test for take ownership
1 parent 506f726 commit 71d10ff

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
Class UnitTest.SourceControl.Git.Utils.TakeOwnership Extends UnitTest.SourceControl.Git.AbstractTest
2+
{
3+
4+
Method TestTakeOwnership()
5+
{
6+
set internalName = "Test.Package.TestClass.cls"
7+
8+
&sql(INSERT INTO SourceControl_Git.Change (InternalName, ChangedBy, ItemFile, Action, Committed)
9+
VALUES (:internalName, 'OtherUser', 'cls/Test/Package/TestClass.cls', 'edit', 0))
10+
$$$ThrowSQLIfError(SQLCODE,.%msg)
11+
12+
try {
13+
// Call TakeOwnership and verify it succeeds
14+
do $$$AssertStatusOK(##class(SourceControl.Git.Utils).TakeOwnership(internalName))
15+
16+
// Verify ChangedBy was updated
17+
&sql(SELECT ChangedBy INTO :changedBy FROM SourceControl_Git.Change WHERE InternalName = :internalName)
18+
$$$ThrowSQLIfError(SQLCODE,.%msg)
19+
do $$$AssertEquals(changedBy, $username)
20+
} catch ex {
21+
do $$$AssertStatusOK(ex.AsStatus())
22+
}
23+
24+
// Clean up
25+
&sql(DELETE FROM SourceControl_Git.Change WHERE InternalName = :internalName)
26+
}
27+
28+
}

0 commit comments

Comments
 (0)