Refactor context, fix update test
@@ -112,6 +112,12 @@ func TestAssetFind(t *testing.T) {
types.FixtureRuleWithPerms(types.RuleTypeAsset, types.RulePermRead),
),
)
+ wrongPermsCtx := testutil.NewContext(
+ testutil.ContextWithOrgEnv("default", "default"),
+ testutil.ContextWithRules(
+ types.FixtureRuleWithPerms(types.RuleTypeAsset, types.RulePermCreate),
+ ),
+ )
testCases := []struct {
name string
@@ -151,9 +157,7 @@ func TestAssetFind(t *testing.T) {
},
{
name: "No Read Permission",
- ctx: testutil.NewContext(testutil.ContextWithRules(
- types.FixtureRuleWithPerms(types.RuleTypeAsset, types.RulePermCreate),
- )),
+ ctx: wrongPermsCtx,
record: types.FixtureAsset("asset1"),
params: QueryParams{
"id": "asset1",
@@ -310,6 +314,7 @@ func TestAssetUpdate(t *testing.T) {
)
badAsset := types.FixtureAsset("asset1")
+ badAsset.URL = ""
testCases := []struct {
name string
