@@ -49,7 +49,7 @@ public async Task GetByIdAsync_Returns_200(string culture, string version)
4949 {
5050 // Given
5151 var client = factory . CreateClient ( ) ;
52- var authResponse = await client . PostAsync ( string . Format ( SampleDataV1 . readerLoginEndpoint , culture , version , Roles . Reader ) , null ) ;
52+ var authResponse = await client . PostAsync ( string . Format ( SampleDataV1 . readerLoginEndpoint , culture , version , Roles . Admin ) , null ) ;
5353 var authDetails = JsonConvert . DeserializeObject < AuthenticateResponse > ( await authResponse . Content . ReadAsStringAsync ( ) ) ;
5454 client . DefaultRequestHeaders . Authorization = new AuthenticationHeaderValue ( "Bearer" , authDetails . Token ) ;
5555 var addProductResponse = await client . PostAsJsonAsync ( string . Format ( SampleDataV1 . productEndpoint , culture , version ) , SampleDataV1 . Product ) ;
@@ -92,13 +92,12 @@ public async Task PutAsync_Returns_204(string culture, string version)
9292 var putRequestPayload = new Product
9393 {
9494 Id = products . FirstOrDefault ( ) . Id ,
95- Name = products . FirstOrDefault ( ) . Name ,
96- DeliveryPrice = products . FirstOrDefault ( ) . DeliveryPrice ,
97- Price = products . FirstOrDefault ( ) . Price ,
98- Description = products . FirstOrDefault ( ) . Description
95+ Name = "Newname" ,
96+ DeliveryPrice = 11 ,
97+ Price = 22 ,
98+ Description = "newDescription"
9999 } ;
100-
101- client = await SetupHttpClient ( Roles . Reader , culture , version ) ;
100+ client = await SetupHttpClient ( Roles . Editor , culture , version ) ;
102101
103102 // When
104103 var response = await client . PutAsJsonAsync ( string . Format ( SampleDataV1 . productEndpoint , culture , version ) + $ "/{ id } ", putRequestPayload ) ;
@@ -110,7 +109,7 @@ public async Task PutAsync_Returns_204(string culture, string version)
110109 private async Task < HttpClient > SetupHttpClient ( string role , string culture , string version )
111110 {
112111 var client = factory . CreateClient ( ) ;
113- var authResponse = await client . PostAsync ( string . Format ( SampleDataV1 . readerLoginEndpoint , culture , version , Roles . Reader ) , null ) ;
112+ var authResponse = await client . PostAsync ( string . Format ( SampleDataV1 . readerLoginEndpoint , culture , version , role ) , null ) ;
114113 var authDetails = JsonConvert . DeserializeObject < AuthenticateResponse > ( await authResponse . Content . ReadAsStringAsync ( ) ) ;
115114 client . DefaultRequestHeaders . Authorization = new AuthenticationHeaderValue ( "Bearer" , authDetails . Token ) ;
116115 return client ;
0 commit comments