@@ -16,6 +16,7 @@ namespace Fossology.Rest.Dotnet.Test
16
16
{
17
17
using System ;
18
18
using System . Collections . Generic ;
19
+ using System . ComponentModel . DataAnnotations ;
19
20
using System . Diagnostics ;
20
21
using System . IO ;
21
22
using System . Net ;
@@ -736,6 +737,20 @@ public void TestGetGroupList()
736
737
Assert . IsTrue ( actual . Count > 0 ) ;
737
738
}
738
739
740
+ /// <summary>
741
+ /// Unit test.
742
+ /// </summary>
743
+ [ TestMethod ]
744
+ public void TestCreateGroup ( )
745
+ {
746
+ const string GroupName = "TestGroup1" ;
747
+
748
+ var client = new FossologyClient ( LocalUrl , Token ) ;
749
+ var actual = client . CreateGroup ( GroupName ) ;
750
+ Assert . IsNotNull ( actual ) ;
751
+ Assert . AreEqual ( 200 , actual . Code ) ;
752
+ }
753
+
739
754
/// <summary>
740
755
/// Unit test.
741
756
/// </summary>
@@ -814,21 +829,38 @@ public void TestCreateLicense()
814
829
Assert . AreEqual ( 201 , actual . Code ) ;
815
830
}
816
831
817
- #if false // not yet supported by Fossology
818
832
/// <summary>
819
833
/// Unit test.
820
834
/// </summary>
821
835
[ TestMethod ]
822
- public void TestCreateGroup ( )
836
+ public void TestFileSearch ( )
823
837
{
824
- const string GroupName = "TestGroup" ;
825
-
826
838
var client = new FossologyClient ( LocalUrl , Token ) ;
827
- var actual = client . CreateGroup ( GroupName ) ;
839
+ var hash = new Hash ( ) ;
840
+ hash . Sha1 = "81fe8bfe87576c3ecb22426f8e57847382917acf" ;
841
+ hash . Md5 = "e2fc714c4727ee9395f324cd2e7f331f" ;
842
+ hash . Sha256 = "88d4266fd4e6338d13b845fcf289579d209c897823b9217da3e161936f031589" ;
843
+ hash . Size = 0 ;
844
+ var hashes = new List < Hash > ( ) ;
845
+ hashes . Add ( hash ) ;
846
+
847
+ var actual = client . SearchForFile ( hashes ) ;
828
848
Assert . IsNotNull ( actual ) ;
829
- //Assert.AreEqual("OK", actual.Status);
849
+ Assert . IsTrue ( actual . Length > 0 ) ;
850
+
851
+ // always returns
852
+ // [
853
+ // {
854
+ // "hash" : {
855
+ // "sha1":null,
856
+ // "md5":null,
857
+ // "sha256":null,
858
+ // "size":null
859
+ // },
860
+ // "message": "Invalid keys"
861
+ // }
862
+ // ]"
830
863
}
831
- #endif
832
864
833
865
//// ---------------------------------------------------------------------
834
866
0 commit comments