4
4
"context"
5
5
"database/sql"
6
6
"encoding/json"
7
- "fmt"
8
7
"net/http"
9
8
"testing"
10
9
"time"
@@ -24,21 +23,19 @@ import (
24
23
25
24
var (
26
25
// use fixed IDs so logs are easier to read
27
- templateID = uuid .MustParse ("12341234-0000-0000-0001-000000000000" )
28
- activeVersionID = uuid .MustParse ("12341234-0000-0000-0002-000000000000" )
29
- inactiveVersionID = uuid .MustParse ("12341234-0000-0000-0003-000000000000" )
30
- activeJobID = uuid .MustParse ("12341234-0000-0000-0004-000000000000" )
31
- inactiveJobID = uuid .MustParse ("12341234-0000-0000-0005-000000000000" )
32
- orgID = uuid .MustParse ("12341234-0000-0000-0006-000000000000" )
33
- workspaceID = uuid .MustParse ("12341234-0000-0000-0007-000000000000" )
34
- userID = uuid .MustParse ("12341234-0000-0000-0008-000000000000" )
35
- activeFileID = uuid .MustParse ("12341234-0000-0000-0009-000000000000" )
36
- inactiveFileID = uuid .MustParse ("12341234-0000-0000-000a-000000000000" )
37
- lastBuildID = uuid .MustParse ("12341234-0000-0000-000b-000000000000" )
38
- lastBuildJobID = uuid .MustParse ("12341234-0000-0000-000c-000000000000" )
39
- otherUserID = uuid .MustParse ("12341234-0000-0000-000d-000000000000" )
40
- notReplacedParamID = uuid .MustParse ("12341234-0000-0000-000e-000000000000" )
41
- replacedParamID = uuid .MustParse ("12341234-0000-0000-000f-000000000000" )
26
+ templateID = uuid .MustParse ("12341234-0000-0000-0001-000000000000" )
27
+ activeVersionID = uuid .MustParse ("12341234-0000-0000-0002-000000000000" )
28
+ inactiveVersionID = uuid .MustParse ("12341234-0000-0000-0003-000000000000" )
29
+ activeJobID = uuid .MustParse ("12341234-0000-0000-0004-000000000000" )
30
+ inactiveJobID = uuid .MustParse ("12341234-0000-0000-0005-000000000000" )
31
+ orgID = uuid .MustParse ("12341234-0000-0000-0006-000000000000" )
32
+ workspaceID = uuid .MustParse ("12341234-0000-0000-0007-000000000000" )
33
+ userID = uuid .MustParse ("12341234-0000-0000-0008-000000000000" )
34
+ activeFileID = uuid .MustParse ("12341234-0000-0000-0009-000000000000" )
35
+ inactiveFileID = uuid .MustParse ("12341234-0000-0000-000a-000000000000" )
36
+ lastBuildID = uuid .MustParse ("12341234-0000-0000-000b-000000000000" )
37
+ lastBuildJobID = uuid .MustParse ("12341234-0000-0000-000c-000000000000" )
38
+ otherUserID = uuid .MustParse ("12341234-0000-0000-000d-000000000000" )
42
39
)
43
40
44
41
func TestBuilder_NoOptions (t * testing.T ) {
@@ -732,43 +729,3 @@ func expectBuildParameters(
732
729
)
733
730
}
734
731
}
735
-
736
- type insertParameterMatcher struct {
737
- name string
738
- value string
739
- }
740
-
741
- func (m insertParameterMatcher ) Matches (x interface {}) bool {
742
- p , ok := x .(database.InsertParameterValueParams )
743
- if ! ok {
744
- return false
745
- }
746
- if p .Name != m .name {
747
- return false
748
- }
749
- return p .SourceValue == m .value
750
- }
751
-
752
- func (m insertParameterMatcher ) String () string {
753
- return fmt .Sprintf ("ParameterValue %s=%s" , m .name , m .value )
754
- }
755
-
756
- func expectReplacedParam (oldID uuid.UUID , name , newValue string ) func (store * dbmock.MockStore ) {
757
- return func (mTx * dbmock.MockStore ) {
758
- del := mTx .EXPECT ().DeleteParameterValueByID (gomock .Any (), oldID ).
759
- Times (1 ).
760
- Return (nil )
761
- mTx .EXPECT ().InsertParameterValue (gomock .Any (), insertParameterMatcher {name , newValue }).
762
- Times (1 ).
763
- After (del ).
764
- Return (database.ParameterValue {}, nil )
765
- }
766
- }
767
-
768
- func expectInsertedParam (name , newValue string ) func (store * dbmock.MockStore ) {
769
- return func (mTx * dbmock.MockStore ) {
770
- mTx .EXPECT ().InsertParameterValue (gomock .Any (), insertParameterMatcher {name , newValue }).
771
- Times (1 ).
772
- Return (database.ParameterValue {}, nil )
773
- }
774
- }
0 commit comments