from lettuce import *
import requests
import json


tenantList = [ "511", "615", "634", "515" ]

def initialize():
  with open("properties.json") as config_file:
    world.config = json.load(config_file)

@before.each_scenario
def cleanContext(feature):
  for tenant in tenantList:
    url = world.config['targetUrl'] + '/pap/v1/' + tenant
    r = requests.delete(url)

initialize()      

from lettuce import *
import requests
import json
import os


tenantList = [ "511", "615", "634", "515" ]

def initialize():
  if os.getenv("LETTUCE_CONFIG"):
    filename = os.getenv("LETTUCE_CONFIG")
  else:
    filename = "properties.json"

  with open(filename) as config_file:
    world.config = json.load(config_file)

@before.each_scenario
def cleanContext(feature):
  for tenant in tenantList:
    url = world.config['targetUrl'] + '/pap/v1/' + tenant
    r = requests.delete(url)

initialize()      

ADD Name of the configuration file in a environment variable
ADD Name of the configuration file in a environment variable

  from lettuce import *
  import requests
  import json
+ import os
  
  
  tenantList = [ "511", "615", "634", "515" ]
  
  def initialize():
-   with open("properties.json") as config_file:
+   if os.getenv("LETTUCE_CONFIG"):
+     filename = os.getenv("LETTUCE_CONFIG")
+   else:
+     filename = "properties.json"
+ 
+   with open(filename) as config_file:
      world.config = json.load(config_file)
  
  @before.each_scenario
  def cleanContext(feature):
    for tenant in tenantList:
      url = world.config['targetUrl'] + '/pap/v1/' + tenant
      r = requests.delete(url)
  
  initialize()      
  
ADD Name of the configuration file in a environment variable
## Code Before:
from lettuce import *
import requests
import json


tenantList = [ "511", "615", "634", "515" ]

def initialize():
  with open("properties.json") as config_file:
    world.config = json.load(config_file)

@before.each_scenario
def cleanContext(feature):
  for tenant in tenantList:
    url = world.config['targetUrl'] + '/pap/v1/' + tenant
    r = requests.delete(url)

initialize()      

## Instruction:
ADD Name of the configuration file in a environment variable
## Code After:
from lettuce import *
import requests
import json
import os


tenantList = [ "511", "615", "634", "515" ]

def initialize():
  if os.getenv("LETTUCE_CONFIG"):
    filename = os.getenv("LETTUCE_CONFIG")
  else:
    filename = "properties.json"

  with open(filename) as config_file:
    world.config = json.load(config_file)

@before.each_scenario
def cleanContext(feature):
  for tenant in tenantList:
    url = world.config['targetUrl'] + '/pap/v1/' + tenant
    r = requests.delete(url)

initialize()      
