(c *check.C)
| 933 | } |
| 934 | |
| 935 | func (s *ProvisionSuite) TestGrantServiceAccessToTeam(c *check.C) { |
| 936 | t := &authTypes.Team{Name: "blaaaa"} |
| 937 | se := service.Service{ |
| 938 | Name: "my-service", |
| 939 | OwnerTeams: []string{s.team.Name}, |
| 940 | Endpoint: map[string]string{"production": "http://localhost:1234"}, |
| 941 | Password: "abcde", |
| 942 | } |
| 943 | err := service.Create(context.TODO(), se) |
| 944 | c.Assert(err, check.IsNil) |
| 945 | u := fmt.Sprintf("/services/%s/team/%s", se.Name, t.Name) |
| 946 | recorder, request := s.makeRequest(http.MethodPut, u, "", c) |
| 947 | s.testServer.ServeHTTP(recorder, request) |
| 948 | c.Assert(recorder.Code, check.Equals, http.StatusOK) |
| 949 | se, err = service.Get(context.TODO(), "my-service") |
| 950 | c.Assert(err, check.IsNil) |
| 951 | c.Assert(*t, HasAccessTo, se) |
| 952 | c.Assert(eventtest.EventDesc{ |
| 953 | Target: serviceTarget("my-service"), |
| 954 | Owner: s.token.GetUserName(), |
| 955 | Kind: "service.update.grant-access", |
| 956 | StartCustomData: []map[string]interface{}{ |
| 957 | {"name": ":service", "value": "my-service"}, |
| 958 | {"name": ":team", "value": t.Name}, |
| 959 | }, |
| 960 | }, eventtest.HasEvent) |
| 961 | } |
| 962 | |
| 963 | func (s *ProvisionSuite) TestGrantAccessToTeamServiceNotFound(c *check.C) { |
| 964 | u := fmt.Sprintf("/services/nononono/team/%s", s.team.Name) |
nothing calls this directly
no test coverage detected