<commit_before>Feature: Metrics API

  Background:
    Given I send and accept JSON
  
  Scenario: GET list of all metrics
    Given there is a metric in the database with the name "membership-coverage"
    And there is a metric in the database with the name "membership-count"
    When I send a GET request to "metrics"
    Then the response status should be "200"
    And the JSON response should have "$.metrics[0].name" with the text "membership-coverage"
    And the JSON response should have "$.metrics[0].url" with the text "http://example.org/metrics/membership-coverage.json"
    And the JSON response should have "$.metrics[1].name" with the text "membership-count"
    And the JSON response should have "$.metrics[1].url" with the text "http://example.org/metrics/membership-count.json"
    
  Scenario: POSTing data
    When I send a POST request to "metrics/membership-coverage" with the following:
      """
      {
        "name": "membership-coverage",
        "time": "2013-12-25T15:00:00+00:00",
        "value": {
                  "health": 0.33,
                  "telecoms": 0.33,
                  "energy": 0.33
                 }
      }
      """
    Then the response status should be "201"    
    And the data should be stored in the "membership-coverage" metric
    And the time of the stored metric should be "2013-12-25T15:00:00+00:00"
    And the value of the metric should be:
      """
      {"health":0.33,"telecoms":0.33,"energy":0.33}
      """ 
      
  Scenario: GETing data
    Given there is a metric in the database with the name "membership-coverage"
    And it has a time of "2013-12-25T15:00:00+00:00"
    And it has a value of:
      """
      {"health":0.34,"telecoms":0.34,"energy":0.34}
      """
    And there is a metric in the database with the name "membership-coverage"
    And it has a time of "2013-12-24T15:00:00+00:00"
    And it has a value of:
      """
      {"health":0.33,"telecoms":0.33,"energy":0.33}
      """
    When I send a GET request to "metrics/membership-coverage"
    Then the response status should be "200"
    Then the JSON response should have "$.name" with the text "membership-coverage"
    And the JSON response should have "$.time" with the text "2013-12-25T15:00:00+00:00"
    And the JSON response should have "$.value.health" with the text "0.33"
    And the JSON response should have "$.value.telecoms" with the text "0.33"
    And the JSON response should have "$.value.energy" with the text "0.33"
    
<commit_msg>Fix broken test<commit_after>Feature: Metrics API

  Background:
    Given I send and accept JSON
  
  Scenario: GET list of all metrics
    Given there is a metric in the database with the name "membership-coverage"
    And there is a metric in the database with the name "membership-count"
    When I send a GET request to "metrics"
    Then the response status should be "200"
    And the JSON response should have "$.metrics[0].name" with the text "membership-coverage"
    And the JSON response should have "$.metrics[0].url" with the text "http://example.org/metrics/membership-coverage.json"
    And the JSON response should have "$.metrics[1].name" with the text "membership-count"
    And the JSON response should have "$.metrics[1].url" with the text "http://example.org/metrics/membership-count.json"
    
  Scenario: POSTing data
    When I send a POST request to "metrics/membership-coverage" with the following:
      """
      {
        "name": "membership-coverage",
        "time": "2013-12-25T15:00:00+00:00",
        "value": {
                  "health": 0.33,
                  "telecoms": 0.33,
                  "energy": 0.33
                 }
      }
      """
    Then the response status should be "201"    
    And the data should be stored in the "membership-coverage" metric
    And the time of the stored metric should be "2013-12-25T15:00:00+00:00"
    And the value of the metric should be:
      """
      {"health":0.33,"telecoms":0.33,"energy":0.33}
      """ 
      
  Scenario: GETing data
    Given there is a metric in the database with the name "membership-coverage"
    And it has a time of "2013-12-25T15:00:00+00:00"
    And it has a value of:
      """
      {"health":0.34,"telecoms":0.34,"energy":0.34}
      """
    And there is a metric in the database with the name "membership-coverage"
    And it has a time of "2013-12-24T15:00:00+00:00"
    And it has a value of:
      """
      {"health":0.33,"telecoms":0.33,"energy":0.33}
      """
    When I send a GET request to "metrics/membership-coverage"
    Then the response status should be "200"
    Then the JSON response should have "$.name" with the text "membership-coverage"
    And the JSON response should have "$.time" with the text "2013-12-25T15:00:00+00:00"
    And the JSON response should have "$.value.health" with the text "0.34"
    And the JSON response should have "$.value.telecoms" with the text "0.34"
    And the JSON response should have "$.value.energy" with the text "0.34"  
    

{'fraction_non_alphanumeric': 0.11009174311926606, 'fraction_numerical': 0.059034702832070206, 'mean_word_length': 2.673992673992674, 'pattern_counts': {'":': 30, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5497431', 'n_tokens_mistral': 1694, 'n_tokens_neox': 1531, 'n_words': 572}